Created
October 3, 2022 21:42
-
-
Save AmosLewis/fa8662eef03c3379bda6a3974036abd1 to your computer and use it in GitHub Desktop.
ElementwiseWhereSelfModulemlir
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
#loc0 = loc(unknown) | |
module attributes {torch.debug_module_name = "ElementwiseWhereSelfModule"} { | |
func.func @forward(%arg0: tensor<1x1x1xf32> loc(unknown), %arg1: tensor<1x1xf32> loc(unknown), %arg2: tensor<1xf32> loc(unknown)) -> tensor<1x1x1xf32> { | |
%cst = arith.constant dense<5.000000e-01> : tensor<1x1x1xf32> loc(#loc1) | |
%0 = "tosa.greater"(%arg0, %cst) : (tensor<1x1x1xf32>, tensor<1x1x1xf32>) -> tensor<1x1x1xi1> loc(#loc1) | |
%1 = "tosa.select"(%0, %arg1, %arg2) : (tensor<1x1x1xi1>, tensor<1x1xf32>, tensor<1xf32>) -> tensor<1x1x1xf32> loc(#loc2) | |
return %1 : tensor<1x1x1xf32> loc(#loc0) | |
} loc(#loc0) | |
} loc(#loc0) | |
#loc1 = loc("/home/chi/src/ubuntu20/shark/torch-mlir/build/tools/torch-mlir/python_packages/torch_mlir/torch_mlir_e2e_test/test_suite/elementwise.py":150:27) | |
#loc2 = loc("/home/chi/src/ubuntu20/shark/torch-mlir/build/tools/torch-mlir/python_packages/torch_mlir/torch_mlir_e2e_test/test_suite/elementwise.py":150:15) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(mlir_venv) nod% torch-mlir-opt -pass-pipeline='torch-backend-to-tosa-backend-pipeline' /tmp/ElementwiseWhereSelfModule.mlir -mlir-print-ir-after-all -mlir-pretty-debuginfo -mlir-disable-threading
// -----// IR Dump After ConvertTorchToTosa (convert-torch-to-tosa) //----- //
func.func @forward(%arg0: tensor<1x1x1xf32>, %arg1: tensor<1x1xf32>, %arg2: tensor<1xf32>) -> tensor<1x1x1xf32> {
%cst = arith.constant dense<5.000000e-01> : tensor<1x1x1xf32>
%0 = "tosa.greater"(%arg0, %cst) : (tensor<1x1x1xf32>, tensor<1x1x1xf32>) -> tensor<1x1x1xi1>
%1 = "tosa.select"(%0, %arg1, %arg2) : (tensor<1x1x1xi1>, tensor<1x1xf32>, tensor<1xf32>) -> tensor<1x1x1xf32>
return %1 : tensor<1x1x1xf32>
}
// -----// IR Dump After TosaMakeBroadcastable (tosa-make-broadcastable) //----- //
func.func @forward(%arg0: tensor<1x1x1xf32>, %arg1: tensor<1x1xf32>, %arg2: tensor<1xf32>) -> tensor<1x1x1xf32> {
%cst = arith.constant dense<5.000000e-01> : tensor<1x1x1xf32>
%0 = "tosa.greater"(%arg0, %cst) : (tensor<1x1x1xf32>, tensor<1x1x1xf32>) -> tensor<1x1x1xi1>
%1 = "tosa.select"(%0, %arg1, %arg2) : (tensor<1x1x1xi1>, tensor<1x1xf32>, tensor<1xf32>) -> tensor<1x1x1xf32>
return %1 : tensor<1x1x1xf32>
}
// -----// IR Dump After Canonicalizer (canonicalize) //----- //
func.func @forward(%arg0: tensor<1x1x1xf32>, %arg1: tensor<1x1xf32>, %arg2: tensor<1xf32>) -> tensor<1x1x1xf32> {
%cst = arith.constant dense<5.000000e-01> : tensor<1x1x1xf32>
%0 = "tosa.greater"(%arg0, %cst) : (tensor<1x1x1xf32>, tensor<1x1x1xf32>) -> tensor<1x1x1xi1>
%1 = "tosa.select"(%0, %arg1, %arg2) : (tensor<1x1x1xi1>, tensor<1x1xf32>, tensor<1xf32>) -> tensor<1x1x1xf32>
return %1 : tensor<1x1x1xf32>
}
// -----// IR Dump After CSE (cse) //----- //
func.func @forward(%arg0: tensor<1x1x1xf32>, %arg1: tensor<1x1xf32>, %arg2: tensor<1xf32>) -> tensor<1x1x1xf32> {
%cst = arith.constant dense<5.000000e-01> : tensor<1x1x1xf32>
%0 = "tosa.greater"(%arg0, %cst) : (tensor<1x1x1xf32>, tensor<1x1x1xf32>) -> tensor<1x1x1xi1>
%1 = "tosa.select"(%0, %arg1, %arg2) : (tensor<1x1x1xi1>, tensor<1x1xf32>, tensor<1xf32>) -> tensor<1x1x1xf32>
return %1 : tensor<1x1x1xf32>
}
// -----// IR Dump After FuncBackendTypeConversion (torch-func-backend-type-conversion) //----- //
module attributes {torch.debug_module_name = "ElementwiseWhereSelfModule"} {
func.func @forward(%arg0: tensor<1x1x1xf32>, %arg1: tensor<1x1xf32>, %arg2: tensor<1xf32>) -> tensor<1x1x1xf32> {
%cst = arith.constant dense<5.000000e-01> : tensor<1x1x1xf32>
%0 = "tosa.greater"(%arg0, %cst) : (tensor<1x1x1xf32>, tensor<1x1x1xf32>) -> tensor<1x1x1xi1>
%1 = "tosa.select"(%0, %arg1, %arg2) : (tensor<1x1x1xi1>, tensor<1x1xf32>, tensor<1xf32>) -> tensor<1x1x1xf32>
return %1 : tensor<1x1x1xf32>
}
}
// -----// IR Dump After Canonicalizer (canonicalize) //----- //
func.func @forward(%arg0: tensor<1x1x1xf32>, %arg1: tensor<1x1xf32>, %arg2: tensor<1xf32>) -> tensor<1x1x1xf32> {
%cst = arith.constant dense<5.000000e-01> : tensor<1x1x1xf32>
%0 = "tosa.greater"(%arg0, %cst) : (tensor<1x1x1xf32>, tensor<1x1x1xf32>) -> tensor<1x1x1xi1>
%1 = "tosa.select"(%0, %arg1, %arg2) : (tensor<1x1x1xi1>, tensor<1x1xf32>, tensor<1xf32>) -> tensor<1x1x1xf32>
return %1 : tensor<1x1x1xf32>
}
// -----// IR Dump After FinalizingBackendTypeConversion (torch-finalizing-backend-type-conversion) //----- //
func.func @forward(%arg0: tensor<1x1x1xf32>, %arg1: tensor<1x1xf32>, %arg2: tensor<1xf32>) -> tensor<1x1x1xf32> {
%cst = arith.constant dense<5.000000e-01> : tensor<1x1x1xf32>
%0 = "tosa.greater"(%arg0, %cst) : (tensor<1x1x1xf32>, tensor<1x1x1xf32>) -> tensor<1x1x1xi1>
%1 = "tosa.select"(%0, %arg1, %arg2) : (tensor<1x1x1xi1>, tensor<1x1xf32>, tensor<1xf32>) -> tensor<1x1x1xf32>
return %1 : tensor<1x1x1xf32>
}
// -----// IR Dump After VerifyTosaBackendContract (torch-verify-tosa-backend-contract) //----- //
module attributes {torch.debug_module_name = "ElementwiseWhereSelfModule"} {
func.func @forward(%arg0: tensor<1x1x1xf32>, %arg1: tensor<1x1xf32>, %arg2: tensor<1xf32>) -> tensor<1x1x1xf32> {
%cst = arith.constant dense<5.000000e-01> : tensor<1x1x1xf32>
%0 = "tosa.greater"(%arg0, %cst) : (tensor<1x1x1xf32>, tensor<1x1x1xf32>) -> tensor<1x1x1xi1>
%1 = "tosa.select"(%0, %arg1, %arg2) : (tensor<1x1x1xi1>, tensor<1x1xf32>, tensor<1xf32>) -> tensor<1x1x1xf32>
return %1 : tensor<1x1x1xf32>
}
}
module attributes {torch.debug_module_name = "ElementwiseWhereSelfModule"} {
func.func @forward(%arg0: tensor<1x1x1xf32>, %arg1: tensor<1x1xf32>, %arg2: tensor<1xf32>) -> tensor<1x1x1xf32> {
%cst = arith.constant dense<5.000000e-01> : tensor<1x1x1xf32>
%0 = "tosa.greater"(%arg0, %cst) : (tensor<1x1x1xf32>, tensor<1x1x1xf32>) -> tensor<1x1x1xi1>
%1 = "tosa.select"(%0, %arg1, %arg2) : (tensor<1x1x1xi1>, tensor<1x1xf32>, tensor<1xf32>) -> tensor<1x1x1xf32>
return %1 : tensor<1x1x1xf32>
}
}
(mlir_venv) nod%