Skip to content

Instantly share code, notes, and snippets.

@pashu123
Created October 22, 2024 17:29
Show Gist options
  • Save pashu123/8310eb0b3007c9cc525c7d3e3f2267e1 to your computer and use it in GitHub Desktop.
Save pashu123/8310eb0b3007c9cc525c7d3e3f2267e1 to your computer and use it in GitHub Desktop.
func.func @time_out(%arg0: tensor<1x1x288x8x4xf32>, %arg1: tensor<1152xf32>) -> tensor<1x1x1152xf32> {
%c0 = arith.constant 0 : index
%5 = tensor.empty() : tensor<1x1x1152xf32>
%unpack = tensor.unpack %arg0 outer_dims_perm = [0, 1, 2] inner_dims_pos = [1, 2] inner_tiles = [8, 4] into %5 : tensor<1x1x288x8x4xf32> -> tensor<1x1x1152xf32>
%6 = linalg.generic {indexing_maps = [affine_map<(d0, d1, d2) -> (d2)>, affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d1, d2)>], iterator_types = ["parallel", "parallel", "parallel"]} ins(%arg1, %unpack : tensor<1152xf32>, tensor<1x1x1152xf32>) outs(%5 : tensor<1x1x1152xf32>) {
^bb0(%in: f32, %in_0: f32, %out: f32):
%7 = arith.addf %in, %in_0 : f32
linalg.yield %7 : f32
} -> tensor<1x1x1152xf32>
return %6: tensor<1x1x1152xf32>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment