-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add @code_hlo
macro to get mlir code
#39
Conversation
Awesome! EDIT: |
Oh this is amazing! One extra thing, would it be possible to have a flag that shows HLO before the pass pipeline of optimizations? And yeah that's a leftover from the transform dialect we use for optimizations |
I added a julia> W = Reactant.ConcreteRArray(randn(Float32, 10, 20))
x = Reactant.ConcreteRArray(randn(Float32, 20, 5))
run_pipeline = false
Reactant.@code_hlo run_pipeline = run_pipeline W * x
Module:
module {
func.func @main(%arg0: tensor<5x20xf32>, %arg1: tensor<20x10xf32>) -> (tensor<20x10xf32>, tensor<5x20xf32>, tensor<5x10xf32>) {
%0 = stablehlo.transpose %arg0, dims = [1, 0] : (tensor<5x20xf32>) -> tensor<20x5xf32>
%1 = stablehlo.transpose %arg1, dims = [1, 0] : (tensor<20x10xf32>) -> tensor<10x20xf32>
%2 = stablehlo.dot_general %1, %0, contracting_dims = [1] x [0], precision = [DEFAULT, DEFAULT] : (tensor<10x20xf32>, tensor<20x5xf32>) -> tensor<10x5xf32>
%3 = stablehlo.transpose %1, dims = [1, 0] : (tensor<10x20xf32>) -> tensor<20x10xf32>
%4 = stablehlo.transpose %0, dims = [1, 0] : (tensor<20x5xf32>) -> tensor<5x20xf32>
%5 = stablehlo.transpose %2, dims = [1, 0] : (tensor<10x5xf32>) -> tensor<5x10xf32>
return %3, %4, %5 : tensor<20x10xf32>, tensor<5x20xf32>, tensor<5x10xf32>
}
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Example usage:
cc @mofeing