brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · 4fe2d42 Raw
118 lines · plain
1func.func @depthwise_conv_1d_nwc_wcm(%input: tensor<1x12x8xf32>, %filter: tensor<3x8x8xf32>)2// <- function.builtin3//        ^ function4//                                   ^ variable.parameter5//                                           ^ type.builtin6//                                                               ^ variable.parameter7//                                                                        ^ type.builtin8  -> tensor<1x10x8x8xf32> {9// ^ operator10//   ^ type.builtin11  %zero = arith.constant 0.000000e+00 : f3212// ^ variable13//        ^ function.builtin14//                       ^ number15//                                      ^ type.builtin16  %init = tensor.empty() : tensor<1x10x8x8xf32>17// ^ variable18//        ^ function.builtin19//                         ^ type.builtin20  %fill = linalg.fill ins(%zero : f32) outs(%init : tensor<1x10x8x8xf32>) -> tensor<1x10x8x8xf32>21// ^ variable22//        ^ function.builtin23//                    ^ keyword24//                        ^ variable25//                                ^ type.builtin26//                                     ^ keyword27  %0 = linalg.depthwise_conv_1d_nwc_wcm {dilations = dense<1> : tensor<1xi64>,28// ^ variable29//     ^ function.builtin30//                                       ^ attribute31//                                                   ^ constant.builtin32    strides = dense<1> : tensor<1xi64>}33//            ^ constant.builtin34    ins(%input, %filter : tensor<1x12x8xf32>, tensor<3x8x8xf32>)35//      ^ variable.parameter36//              ^ variable.parameter37    outs(%fill : tensor<1x10x8x8xf32>) -> tensor<1x10x8x8xf32>38//       ^ variable39  return %0 : tensor<1x10x8x8xf32>40// ^ function.builtin41//       ^ variable42}43 44func.func @fastmath(%arg0: f32, %arg1: f32) {45// <- function.builtin46//        ^ function47//                  ^ variable.parameter48//                         ^ type.builtin49//                              ^ variable.parameter50//                                     ^ type.builtin51  %5 = arith.negf %arg0 fastmath<fast> : f3252//     ^ function.builtin53//                      ^ attribute54  %6 = arith.addf %arg0, %arg1 fastmath<none> : f3255//     ^ function.builtin56//                             ^ attribute57  %8 = arith.mulf %arg0, %arg1 fastmath<reassoc,nnan,ninf,nsz,arcp,contract,afn> : f3258//     ^ function.builtin59//                             ^ attribute60  return61// ^ function.builtin62}63 64#map0 = affine_map<(d0, d1) -> (d0, d1)>65// <- attribute66//      ^ attribute67#map1 = affine_map<(d0, d1) -> (d0)>68// <- attribute69//      ^ attribute70#map2 = affine_map<(d0) -> (d0)>71// <- attribute72//      ^ attribute73 74func.func @add_broadcast_mul_fusion(%arg0: tensor<?xf32>, %arg1 : tensor<?xf32>,75  %arg2 : tensor<?x?xf32>) -> tensor<?x?xf32>76{77  %c0 = arith.constant 0 : index78  %c1 = arith.constant 1 : index79  %0 = tensor.dim %arg0, %c0 : tensor<?xf32>80  %1 = tensor.empty(%0) : tensor<?xf32>81  %2 = linalg.generic {indexing_maps = [#map2, #map2, #map2], iterator_types = ["parallel"]}82//                                      ^ attribute83//                                             ^ attribute84//                                                    ^ attribute85      ins(%arg0, %arg1 : tensor<?xf32>, tensor<?xf32>)86//    ^ keyword87      outs(%1 : tensor<?xf32>) {88//    ^ keyword89    ^bb0(%arg3: f32, %arg4: f32, %arg5: f32):90      %3 = arith.addf %arg3, %arg4 : f3291      linalg.yield %3 : f3292  } -> tensor<?xf32>93  %3 = tensor.dim %arg2, %c1 : tensor<?x?xf32>94  %4 = tensor.empty(%0, %3) : tensor<?x?xf32>95  %5 = linalg.generic {indexing_maps = [#map1, #map0, #map0], iterator_types = ["parallel", "parallel"]}96//     ^ function.builtin97      ins(%2, %arg2 : tensor<?xf32>, tensor<?x?xf32>)98      outs(%4 : tensor<?x?xf32>){99    ^bb0(%arg5: f32, %arg6: f32, %arg7: f32):100      %6 = arith.mulf %arg5, %arg6 : f32101      linalg.yield %6 : f32102    } -> tensor<?x?xf32>103  return %5 : tensor<?x?xf32>104}105 106func.func @broadcast(%input: tensor<8x32xf32>,107                     %init: tensor<8x16x32xf32>) -> tensor<8x16x32xf32> {108  %bcast = linalg.broadcast109//         ^ function.builtin110      ins(%input:tensor<8x32xf32>)111//    ^ keyword112      outs(%init:tensor<8x16x32xf32>)113//    ^ keyword114      dimensions = [1]115//    ^ attribute116  func.return %bcast : tensor<8x16x32xf32>117}118