Created
May 10, 2025 04:44
-
-
Save pashu123/14b47de2e4d98fc01628ab7b377f10bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#map = affine_map<(d0, d1, d2) -> (d0, d1)> | |
#map1 = affine_map<(d0, d1, d2) -> (d1, d2)> | |
#map2 = affine_map<(d0, d1, d2) -> (d0, d2)> | |
module { | |
func.func @matmul(%arg0: tensor<2x2816xf16>, %arg1: tensor<2816x1280xf16>) -> 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<2x2816xf16>, tensor<2816x1280xf16>) 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