diff options
author | acxz | 2022-05-05 17:44:50 -0400 |
---|---|---|
committer | acxz | 2022-05-05 17:44:50 -0400 |
commit | 7eed3af87685160adf6a80d6f96c6413e2ba42af (patch) | |
tree | 0f855f8c92dce2354ccacd28b1af3bd5263b52c2 | |
parent | f4ed1f30c38e3326f79ef798df1d0bd9517d252c (diff) | |
download | aur-7eed3af87685160adf6a80d6f96c6413e2ba42af.tar.gz |
upgpkg: python-pytorch-rocm 1.11.0-3: Fix FS#74593
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | 98f9ff90268ae62ab6d794cce0786121bf17edc9.patch | 44 | ||||
-rw-r--r-- | PKGBUILD | 7 |
3 files changed, 53 insertions, 2 deletions
@@ -1,7 +1,7 @@ pkgbase = python-pytorch-rocm pkgdesc = Tensors and Dynamic neural networks in Python with strong GPU acceleration pkgver = 1.11.0 - pkgrel = 2 + pkgrel = 3 url = https://pytorch.org arch = x86_64 license = BSD @@ -78,6 +78,7 @@ pkgbase = python-pytorch-rocm source = fix_include_system.patch source = use-system-libuv.patch source = fix-building-for-torchvision.patch + source = 98f9ff90268ae62ab6d794cce0786121bf17edc9.patch source = ffmpeg4.4.patch source = https://github.com/pytorch/pytorch/commit/eb4e6ca30c2cd876007cd2dbbdea7f7803af0518.patch sha256sums = SKIP @@ -122,6 +123,7 @@ pkgbase = python-pytorch-rocm sha256sums = 557761502bbd994d9795bef46779e4b8c60ba0b45e7d60841f477d3b7f28a00a sha256sums = cd9ac4aaa9f946ac5eafc57cf66c5c16b3ea7ac8af32c2558fad0705411bb669 sha256sums = 600bd6a4bbcec9f99ab815d82cee1c2875530b2b75f4010da5ba72ce9bf31aff + sha256sums = cf6ec8e4952765b190e1cae247a814dd1e6b3e9c8b3ad5600118d69d6faa6eb5 sha256sums = 75001b59e76831b0c93a547f851cb980e00b0d8cc7b66fb507eaeac217dc6ff9 sha256sums = SKIP diff --git a/98f9ff90268ae62ab6d794cce0786121bf17edc9.patch b/98f9ff90268ae62ab6d794cce0786121bf17edc9.patch new file mode 100644 index 000000000000..49afb11b57b3 --- /dev/null +++ b/98f9ff90268ae62ab6d794cce0786121bf17edc9.patch @@ -0,0 +1,44 @@ +From 98f9ff90268ae62ab6d794cce0786121bf17edc9 Mon Sep 17 00:00:00 2001 +From: BowenBao <bowbao@microsoft.com> +Date: Thu, 17 Feb 2022 10:45:24 -0800 +Subject: [PATCH] [ONNX] Fix an assertion failure involving Slice (#71965) + +Before this change, exporting a model to ONNX involving Slice crashes at `axes[i]` in line 153 if C++ assertions are enabled: +``` +/usr/include/c++/11.1.0/bits/stl_vector.h:1045: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = long int; _Alloc = std::allocator<long int>; std::vector<_Tp, _Alloc>::reference = long int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__n < this->size()' failed. +``` +The relevant check is https://github.com/gcc-mirror/gcc/blob/releases/gcc-11.1.0/libstdc++-v3/include/bits/stl_vector.h#L1045, which checks the vector index. + +The issue can be reproduced by exporting Mask R-CNN or similar ones. For example, +```Python +import io +import torch +import torchvision as tv + +model = tv.models.detection.maskrcnn_resnet50_fpn(pretrained=False) +x = [torch.rand(3, 300, 400), torch.rand(3, 500, 400)] +with io.BytesIO() as f: + torch.onnx.export(model, x, f, opset_version=11) +``` +(extracted from [onnxoptimizer tests](https://github.com/onnx/optimizer/blob/master/onnxoptimizer/test/optimizer_test.py)) + +Tested environment: Arch Linux x86_64 with pytorch and torchvisoin installed from [the official repo](https://github.com/archlinux/svntogit-community/blob/packages/python-pytorch/trunk/PKGBUILD) and [AUR](https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=python-torchvision), respectively. + +Pull Request resolved: https://github.com/pytorch/pytorch/pull/72989 +--- + torch/csrc/jit/passes/onnx/constant_fold.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/torch/csrc/jit/passes/onnx/constant_fold.cpp b/torch/csrc/jit/passes/onnx/constant_fold.cpp +index 2901a9b8043c0..e52d77d04c756 100644 +--- a/torch/csrc/jit/passes/onnx/constant_fold.cpp ++++ b/torch/csrc/jit/passes/onnx/constant_fold.cpp +@@ -147,7 +147,7 @@ c10::optional<at::Tensor> runTorchSlice_opset10( + return c10::nullopt; + } + auto axes_a = inputTensorValues[3].accessor<int64_t, 1>(); +- axes.reserve(inputTensorValues[3].sizes()[0]); ++ axes.resize(inputTensorValues[3].sizes()[0]); + // ONNX slice accepts negative axis, fix this for aten op + for (const auto i : c10::irange(inputTensorValues[3].sizes()[0])) { + axes[i] = axes_a[i] < 0 ? axes_a[i] + inputTensorValues[0].sizes().size() @@ -7,7 +7,7 @@ pkgname=python-pytorch-rocm _pkgname="pytorch" pkgver=1.11.0 _pkgver=1.11.0 -pkgrel=2 +pkgrel=3 _pkgdesc="Tensors and Dynamic neural networks in Python with strong GPU acceleration" pkgdesc="${_pkgdesc}" arch=('x86_64') @@ -62,6 +62,7 @@ source=("${_pkgname}-${pkgver}::git+https://github.com/pytorch/pytorch.git#tag=v fix_include_system.patch use-system-libuv.patch fix-building-for-torchvision.patch + 98f9ff90268ae62ab6d794cce0786121bf17edc9.patch ffmpeg4.4.patch https://github.com/pytorch/pytorch/commit/eb4e6ca30c2cd876007cd2dbbdea7f7803af0518.patch) sha256sums=('SKIP' @@ -106,6 +107,7 @@ sha256sums=('SKIP' '557761502bbd994d9795bef46779e4b8c60ba0b45e7d60841f477d3b7f28a00a' 'cd9ac4aaa9f946ac5eafc57cf66c5c16b3ea7ac8af32c2558fad0705411bb669' '600bd6a4bbcec9f99ab815d82cee1c2875530b2b75f4010da5ba72ce9bf31aff' + 'cf6ec8e4952765b190e1cae247a814dd1e6b3e9c8b3ad5600118d69d6faa6eb5' '75001b59e76831b0c93a547f851cb980e00b0d8cc7b66fb507eaeac217dc6ff9' 'SKIP') options=('!lto') @@ -170,6 +172,9 @@ prepare() { # https://bugs.archlinux.org/task/64981 patch -N torch/utils/cpp_extension.py "${srcdir}"/fix_include_system.patch + # Fix https://bugs.archlinux.org/task/74593 + patch -Np1 -i "${srcdir}"/98f9ff90268ae62ab6d794cce0786121bf17edc9.patch + # Use system libuv patch -Np1 -i "${srcdir}"/use-system-libuv.patch |