forked from llvm/torch-mlir
-
Notifications
You must be signed in to change notification settings - Fork 5
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
[AutoBump] Merge with 513d89c1 (May 17, needs LLVM bump) (38) #271
Merged
Conversation
This file contains 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
Downstream MLIR sparsifier has some (rudimentary) support for ReLU now, and this test can now be enabled with correct end-to-end behavior. Also see discussion at: https://discourse.llvm.org/t/min-max-abs-relu-recognition-starter-project/78918
This commit adds the OnnxToTorch support for ReduceLogSumExp op
nod-ai/SHARK-ModelDev#658 --------- Co-authored-by: root <[email protected]>
As mentioned in issue llvm#3290 , the difference between onnx.Transpose in versions 1 and 13 is minimal, and therefore should be supported with the same conversion pattern.
In constant folding progress, a new constant op will be created according to the origin op's result type. See the code in TorchDialect.cpp. ```cpp Operation *TorchDialect::materializeConstant(OpBuilder &builder, Attribute value, Type type, Location loc) { if (auto integerType = dyn_cast<Torch::IntType>(type)) return builder.create<Torch::ConstantIntOp>(loc, cast<IntegerAttr>(value)); if (auto floatType = dyn_cast<Torch::FloatType>(type)) return builder.create<Torch::ConstantFloatOp>(loc, cast<FloatAttr>(value)); if (auto numberType = dyn_cast<Torch::NumberType>(type)) { if (auto floatValue = dyn_cast<mlir::FloatAttr>(value)) { return builder.create<Torch::ConstantNumberOp>(loc, floatValue); } else if (auto intValue = dyn_cast<mlir::IntegerAttr>(value)) { return builder.create<Torch::ConstantNumberOp>(loc, intValue); } } if (isa<Torch::BoolType>(type)) { return builder.create<Torch::ConstantBoolOp>(loc, cast<IntegerAttr>(value)); } if (isa<Torch::NoneType>(type)) return builder.create<ConstantNoneOp>(loc); if (auto stringAttr = dyn_cast<StringAttr>(value)) return builder.create<ConstantStrOp>(loc, stringAttr); if (auto elementsAttr = dyn_cast<ElementsAttr>(value)) { // Only !torch.vtensor can be constant folded. !torch.tensor has // non-trivial aliasing semantics which prevent deduplicating it. assert(isa<ValueTensorType>(type) && "should be a vtensor type!"); return builder.create<ValueTensorLiteralOp>(loc, elementsAttr); } return nullptr; } ``` So when the op has a tensor result type, it must be "ValueTensorType" due to the **assert** statement. However, many fold methods in TorchOps.cpp only have a judgment of "BaseTensorType".
…#3348) * not to decompose `aten.amax` on `stablehlo` backend. Because it could be lowering to `stablehlo.reduce` directly. * lowering `aten.max.dim` to `stablehlo.reduce apply max` when `AtenMaxDimOp.getIndices()` doesn't have users. It's more simple.
Similar to llvm#2824, we were seeing some assertion failures after the addition checks around folders were tightened up in LLVM: llvm/llvm-project#75887 . This PR essentially moves the logic that used to be applied at the LLVM level into the folder, which seems to be the suggested fix.
Signed-off-by: Suraj Sudhir <[email protected]>
Co-authored-by: Yuanqiang Liu <[email protected]>
- Refactors OnnxBackend to be generic and consume any Torch backend. --------- Signed-off-by: Suraj Sudhir <[email protected]>
TODO: Should work with llvm branch bump_to_5901d400 |
mgehre-amd
changed the title
[AutoBump] Merge with 513d89c1 (May 17) (38)
[AutoBump] Merge with 513d89c1 (May 17, needs LLVM bump) (38)
Aug 28, 2024
Base automatically changed from
bump_to_08355be5
to
feature/backport_ea1_ops
September 4, 2024 05:01
An error occurred while trying to automatically change base from
bump_to_08355be5
to
feature/backport_ea1_ops
September 4, 2024 05:01
jorickert
approved these changes
Sep 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Needs LLVM to be Xilinx/llvm-project#314 or later