Skip to content
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

[PyTorch] Update to 2.2.1 and minor changes #1466

Merged
merged 24 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
95f80e5
Restore ExampleStack and TensorExampleStack constructors
HGuillemet Jan 29, 2024
f4a464f
Generate more overloads of methods taking an arrayref
HGuillemet Jan 31, 2024
1c4eec0
Update to PyTorch 2.2.0
HGuillemet Feb 1, 2024
d1d1b54
Add parsing of CUDAFunctions.h
HGuillemet Feb 1, 2024
9d0db45
Add AOTInductor
HGuillemet Feb 1, 2024
6e8fc44
Fix compilation error on Windows
HGuillemet Feb 3, 2024
82cbc2c
Cleanup cppbuild.sh
HGuillemet Feb 3, 2024
00b84d2
Fix linking error on windows
HGuillemet Feb 3, 2024
79348b0
Moved AOTIModelContainerRunnerCuda to main presets
HGuillemet Feb 4, 2024
e6e6aae
Revert "Moved AOTIModelContainerRunnerCuda to main presets"
HGuillemet Feb 4, 2024
9ebb661
Add DynamicLibrary.h to JNI
HGuillemet Feb 4, 2024
344fee4
Revert "Add DynamicLibrary.h to JNI"
HGuillemet Feb 5, 2024
4129ee0
Link jnitorch_cuda with cudnn
HGuillemet Feb 6, 2024
b63ca78
Remove upcast on Module
HGuillemet Feb 7, 2024
84bfcec
Virtualize FunctionPreHook and FunctionPostHook. Remove @StdMove on T…
HGuillemet Feb 8, 2024
d381eba
Remove @StdMove on Storage valueTypes.
HGuillemet Feb 8, 2024
97e1ce6
Remove `@StdMove` on `MaybeOwned<Tensor>`
HGuillemet Feb 8, 2024
a41a0c1
Remove `@StdMove` on `TensorName`
HGuillemet Feb 8, 2024
fff554f
Remove `@StdMove` on `EdgeVector` and `DimnameVector`
HGuillemet Feb 8, 2024
425fe39
Disable AOTInductor
HGuillemet Feb 8, 2024
605704a
Add Module.asX
HGuillemet Feb 11, 2024
5732dca
Add preload of nvrtc-builtins
HGuillemet Feb 14, 2024
7cb77c8
Update to Pytorch 2.2.1
HGuillemet Feb 22, 2024
04ccfc9
Update CHANGELOG.md and fix nits
saudet Mar 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions pytorch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Introduction
------------
This directory contains the JavaCPP Presets module for:

* PyTorch 2.1.2 https://pytorch.org/
* PyTorch 2.2.0 https://pytorch.org/

Please refer to the parent README.md file for more detailed information about the JavaCPP Presets.

Expand Down Expand Up @@ -40,22 +40,22 @@ We can use [Maven 3](http://maven.apache.org/) to download and install automatic
<modelVersion>4.0.0</modelVersion>
<groupId>org.bytedeco.pytorch</groupId>
<artifactId>simplemnist</artifactId>
<version>1.5.10</version>
<version>1.5.11-SNAPSHOT</version>
<properties>
<exec.mainClass>SimpleMNIST</exec.mainClass>
</properties>
<dependencies>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>pytorch-platform</artifactId>
<version>2.1.2-1.5.10</version>
<version>2.2.0-1.5.11-SNAPSHOT</version>
</dependency>

<!-- Additional dependencies required to use CUDA, cuDNN, and NCCL -->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>pytorch-platform-gpu</artifactId>
<version>2.1.2-1.5.10</version>
<version>2.2.0-1.5.11-SNAPSHOT</version>
</dependency>

<!-- Additional dependencies to use bundled CUDA, cuDNN, and NCCL -->
Expand Down
22 changes: 5 additions & 17 deletions pytorch/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if [[ $PLATFORM == windows* ]]; then
export PYTHON_BIN_PATH=$(which python.exe)
fi

PYTORCH_VERSION=2.1.2
PYTORCH_VERSION=2.2.0

export PYTORCH_BUILD_VERSION="$PYTORCH_VERSION"
export PYTORCH_BUILD_NUMBER=1
Expand All @@ -53,8 +53,9 @@ git checkout v$PYTORCH_VERSION
git submodule update --init --recursive
git submodule foreach --recursive 'git reset --hard'

# https://github.com/pytorch/pytorch/pull/66219
#patch -Np1 < ../../../pytorch.patch
# Fix version of this submodule to allow compilation on windows.
# Probably could be removed when we upgrade to next version of PyTorch.
(cd third_party/pocketfft; git checkout 9d3ab05a7fffbc71a492bc6a17be034e83e8f0fe)

CPYTHON_HOST_PATH="$INSTALL_PATH/../../../cpython/cppbuild/$PLATFORM/host/"
CPYTHON_PATH="$INSTALL_PATH/../../../cpython/cppbuild/$PLATFORM/"
Expand Down Expand Up @@ -165,24 +166,11 @@ sedinplace 's/ build_deps()/ build_deps(); sys.exit()/g' setup.py
sedinplace 's/AND NOT DEFINED ENV{CUDAHOSTCXX}//g' cmake/public/cuda.cmake
sedinplace 's/CMAKE_CUDA_FLAGS "/CMAKE_CUDA_FLAGS " --use-local-env /g' CMakeLists.txt

# work around some compiler bugs
sedinplace 's/!defined(__INTEL_COMPILER))/!defined(__INTEL_COMPILER) \&\& (__GNUC__ < 11))/g' third_party/XNNPACK/src/xnnpack/intrinsics-polyfill.h
sedinplace 's/using ExpandingArrayDouble/public: using ExpandingArrayDouble/g' ./torch/csrc/api/include/torch/nn/options/pooling.h
sedinplace 's/typedef c10::variant/public: typedef c10::variant/g' ./torch/csrc/api/include/torch/nn/options/upsampling.h
sedinplace 's/std::copysign/copysignf/g' aten/src/ATen/native/cuda/*.cu
sedinplace 's/std::trunc/truncf/g' aten/src/ATen/native/cuda/*.cu
sedinplace 's/std::floor/floorf/g' aten/src/ATen/native/cuda/*.cu
sedinplace 's/std::ceil/ceilf/g' aten/src/ATen/native/cuda/*.cu
sedinplace 's/round(/roundf(/g' aten/src/ATen/native/cuda/*.cu
sedinplace 's/floor(/floorf(/g' aten/src/ATen/native/cuda/*.cu
sedinplace 's/ceil(/ceilf(/g' aten/src/ATen/native/cuda/*.cu
sedinplace '/#include <thrust\/device_vector.h>/a\
#include <thrust\/host_vector.h>\
' caffe2/utils/math_gpu.cu

# allow setting the build directory and passing CUDA options
sedinplace "s/BUILD_DIR = .build./BUILD_DIR = os.environ['BUILD_DIR'] if 'BUILD_DIR' in os.environ else 'build'/g" tools/setup_helpers/env.py
sedinplace "s/var.startswith(('BUILD_', 'USE_', 'CMAKE_'))/var.startswith(('BUILD_', 'USE_', 'CMAKE_', 'CUDA_'))/g" tools/setup_helpers/cmake.py
sedinplace 's/var.startswith(("BUILD_", "USE_", "CMAKE_"))/var.startswith(("BUILD_", "USE_", "CMAKE_", "CUDA_"))/g' tools/setup_helpers/cmake.py

# allow resizing std::vector<at::indexing::TensorIndex>
sedinplace 's/TensorIndex(c10::nullopt_t)/TensorIndex(c10::nullopt_t none = None)/g' aten/src/ATen/TensorIndexing.h
Expand Down
4 changes: 4 additions & 0 deletions pytorch/include_list.pl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ sub go {

chdir "cppbuild/linux-x86_64-gpu/pytorch/torch/include";

# Doesn't compile on Windows. Waiting for 2.2.1.
#go('torch/csrc/api/include/torch/torch.h', 'torch/script.h', 'torch/csrc/inductor/aoti_model_container_runner.h');
go('torch/csrc/api/include/torch/torch.h', 'torch/script.h');

print <<EOF;
Expand All @@ -62,4 +64,6 @@ sub go {
// c10/cuda/CUDAGuard.h
EOF

# Doesn't compile on Windows. Waiting for 2.2.1.
#go('ATen/cudnn/Descriptors.h', 'ATen/cudnn/Types.h', 'c10/cuda/CUDAGuard.h', '-I/opt/cuda/targets/x86_64-linux/include/', 'torch/csrc/inductor/aoti_model_container_runner_cuda.h');
go('ATen/cudnn/Descriptors.h', 'ATen/cudnn/Types.h', 'c10/cuda/CUDAGuard.h', '-I/opt/cuda/targets/x86_64-linux/include/');
saudet marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion pytorch/platform/gpu/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>org.bytedeco</groupId>
<artifactId>pytorch-platform-gpu</artifactId>
<version>2.1.2-${project.parent.version}</version>
<version>2.2.0-${project.parent.version}</version>
<name>JavaCPP Presets Platform GPU for PyTorch</name>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion pytorch/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>org.bytedeco</groupId>
<artifactId>pytorch-platform</artifactId>
<version>2.1.2-${project.parent.version}</version>
<version>2.2.0-${project.parent.version}</version>
<name>JavaCPP Presets Platform for PyTorch</name>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion pytorch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>org.bytedeco</groupId>
<artifactId>pytorch</artifactId>
<version>2.1.2-${project.parent.version}</version>
<version>2.2.0-${project.parent.version}</version>
<name>JavaCPP Presets for PyTorch</name>

<dependencies>
Expand Down
Loading
Loading