Skip to content

Commit

Permalink
Merge pull request #186 from Xilinx/matthias.gemm_fix_stack_use_after…
Browse files Browse the repository at this point in the history
…_free_release

Fix stack-use-after-free
  • Loading branch information
mgehre-amd authored Jun 21, 2024
2 parents f00e686 + be66af4 commit bd6e22e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/Conversion/TorchOnnxToTorch/DefaultDomainGtoP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,12 +702,13 @@ void mlir::torch::onnx_c::populateDefaultDomainGtoP(
rewriter.getIntegerAttr(rewriter.getIntegerType(64), 1));

auto transpose = [&](Value m) -> Value {
auto tty = m.getType().cast<Torch::ValueTensorType>();
auto shape = tty.getOptionalSizes();
auto tty = cast<Torch::ValueTensorType>(m.getType());
std::optional<ArrayRef<int64_t>> shape = tty.getOptionalSizes();
llvm::SmallVector<int64_t> newShape;
if (shape.has_value()) {
llvm::SmallVector<int64_t> newShape(shape.value());
newShape.append(shape.value().begin(), shape.value().end());
std::reverse(newShape.begin(), newShape.end());
shape = std::move(newShape);
shape = newShape;
}
auto oty = Torch::ValueTensorType::get(tty.getContext(), shape,
tty.getOptionalDtype());
Expand Down

0 comments on commit bd6e22e

Please sign in to comment.