Skip to content

Instantly share code, notes, and snippets.

@pashu123
Created April 23, 2025 23:39
Show Gist options
  • Save pashu123/1a058d1ccf34694996b9b8f8c60dc4d1 to your computer and use it in GitHub Desktop.
Save pashu123/1a058d1ccf34694996b9b8f8c60dc4d1 to your computer and use it in GitHub Desktop.
#map = affine_map<(d0, d1, d2) -> (d2, d0)>
#map1 = affine_map<(d0, d1, d2) -> (d1, d2)>
#map2 = affine_map<(d0, d1, d2) -> (d0, d1)>
module {
func.func @faulty(%arg0: tensor<2816x2xf16>, %arg1: tensor<1280x2816xf16>) -> tensor<2x1280xf32> {
%cst = arith.constant 0.000000e+00 : f32
%0 = tensor.empty() : tensor<2x1280xf32>
%1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<2x1280xf32>) -> tensor<2x1280xf32>
%2 = linalg.generic {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"]} ins(%arg0, %arg1 : tensor<2816x2xf16>, tensor<1280x2816xf16>) outs(%1 : tensor<2x1280xf32>) {
^bb0(%in: f16, %in_0: f16, %out: f32):
%3 = arith.extf %in : f16 to f32
%4 = arith.extf %in_0 : f16 to f32
%5 = arith.mulf %3, %4 : f32
%6 = arith.addf %out, %5 : f32
linalg.yield %6 : f32
} -> tensor<2x1280xf32>
return %2 : tensor<2x1280xf32>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment