8000 Update on "[caffe2] Export operators to c10 without including ATen/Te… · pytorch/pytorch@93b8851 · GitHub
[go: up one dir, main page]

Skip to content

Commit 93b8851

Browse files
committed
Update on "[caffe2] Export operators to c10 without including ATen/Tensor.h"
With this change, the only caffe2 files that depend on `ATen/Tensor.h` are ones that directly use the ATen API. Specifically, ``` [ "caffe2/CMakeFiles/torch_cuda_cpp.dir/contrib/aten/aten_op_gpu.cc.o", "caffe2/CMakeFiles/torch_cpu.dir/core/tensor.cc.o", "caffe2/CMakeFiles/torch_cuda_cpp.dir/operators/layer_norm_op.cu.o", "caffe2/CMakeFiles/torch_cpu.dir/core/IValueInterface.cc.o", "caffe2/CMakeFiles/cuda_tensor_interop_test.dir/__/aten/src/ATen/test/cuda_tensor_interop_test.cpp.o", "caffe2/CMakeFiles/torch_cpu.dir/contrib/aten/aten_op.cc.o", "caffe2/CMakeFiles/caffe2_pybind11_state_gpu.dir/python/pybind_state.cc.o", "caffe2/CMakeFiles/torch_cpu.dir/operators/layer_norm_op.cc.o", "caffe2/CMakeFiles/torch_cpu.dir/core/export_c10_op_to_caffe2.cc.o", "caffe2/CMakeFiles/torch_cpu.dir/core/export_caffe2_op_to_c10.cc.o", "caffe2/CMakeFiles/torch_cpu.dir/operators/enforce_finite_op.cc.o", "caffe2/CMakeFiles/torch_cpu.dir/core/operator.cc.o", "caffe2/CMakeFiles/tensor_interop_test.dir/__/aten/src/ATen/test/tensor_interop_test.cpp.o", "caffe2/CMakeFiles/caffe2_pybind11_state.dir/python/pybind_state.cc.o" ] ``` [ghstack-poisoned]
2 parents 1cffd06 + f1bd5ed commit 93b8851

35 files changed

+137
-306
lines changed

.circleci/docker/common/install_rocm.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@ set -ex
44

55
install_magma() {
66
# "install" hipMAGMA into /opt/rocm/magma by copying after build
7-
git clone https://bitbucket.org/icl/magma.git -b magma_ctrl_launch_bounds
7+
git clone https://bitbucket.org/icl/magma.git
88
pushd magma
9-
# The branch "magma_ctrl_launch_bounds" is having a fix over the below commit, so keeping the below comment for reference.
10-
#git checkout 878b1ce02e9cfe4a829be22c8f911e9c0b6bd88f
11-
# Work around non-asii characters in certain magma sources; remove this after upstream magma fixes this.
12-
perl -i.bak -pe 's/[^[:ascii:]]//g' sparse/control/magma_zfree.cpp
13-
perl -i.bak -pe 's/[^[:ascii:]]//g' sparse/control/magma_zsolverinfo.cpp
9+
# fix for Cholesky issue
10+
git checkout 092253401778a2cd35a214b0436efacebe2e55cd
1411
cp make.inc-examples/make.inc.hip-gcc-mkl make.inc
1512
echo 'LIBDIR += -L$(MKLROOT)/lib' >> make.inc
1613
echo 'LIB += -Wl,--enable-new-dtags -Wl,--rpath,/opt/rocm/lib -Wl,--rpath,$(MKLROOT)/lib -Wl,--rpath,/opt/rocm/magma/lib' >> make.inc
@@ -19,7 +16,7 @@ install_magma() {
1916
sed -i 's/^FOPENMP/#FOPENMP/g' make.inc
2017
export PATH="${PATH}:/opt/rocm/bin"
2118
make -f make.gen.hipMAGMA -j $(nproc)
22-
make lib/libmagma.so -j $(nproc) MKLROOT=/opt/conda
19+
LANG=C.UTF-8 make lib/libmagma.so -j $(nproc) MKLROOT=/opt/conda
2320
make testing/testing_dgemm -j $(nproc) MKLROOT=/opt/conda
2421
popd
2522
mv magma /opt/rocm

.github/templates/windows_ci_workflow.yml.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ on:
3535
env:
3636
BUILD_ENVIRONMENT: !{{ build_environment }}
3737
BUILD_WHEEL: 1
38+
MAX_JOBS: 8
3839
CUDA_VERSION: "!{{ cuda_version }}"
3940
IN_CI: 1
4041
IS_GHA: 1

.github/workflows/generated-periodic-win-vs2019-cuda11.1-py3.yml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/generated-win-vs2019-cpu-py3.yml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/generated-win-vs2019-cuda11.3-py3.yml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,12 +778,14 @@ filegroup(
778778
"caffe2/core/db.cc",
779779
"caffe2/core/event.cc",
780780
"caffe2/core/export_c10_op_to_caffe2.cc",
781+
"caffe2/core/export_caffe2_op_to_c10.cc",
781782
"caffe2/core/graph.cc",
782783
"caffe2/core/init.cc",
783784
"caffe2/core/init_denormals.cc",
784785
"caffe2/core/init_intrinsics_check.cc",
785786
"caffe2/core/init_omp.cc",
786787
"caffe2/core/int8_serialization.cc",
788+
"caffe2/core/IValueInterface.cc",
787789
"caffe2/core/memonger.cc",
788790
"caffe2/core/module.cc",
789791
"caffe2/core/net.cc",

aten/src/ATen/core/boxing/KernelFunction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ TORCH_API void ambiguous_autogradother_kernel(OperatorKernel*, const OperatorHan
7373
namespace kernel_function {
7474

7575
template<class Return, class... Args>
76-
Return call(const KernelFunction &func, const OperatorHandle& opHandle, DispatchKeySet dispatchKeySet, Args... args);
76+
C10_ALWAYS_INLINE Return call(const KernelFunction &func, const OperatorHandle& opHandle, DispatchKeySet dispatchKeySet, Args... args);
7777

7878
template<bool AllowLegacyTypes=false, class KernelFunctor>
7979
inline KernelFunction makeFromUnboxedFunctor(std::unique_ptr<OperatorKernel> kernelFunctor);

aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ endif()
319319
target_include_directories(pytorch_qnnpack PUBLIC include)
320320
target_include_directories(pytorch_qnnpack PUBLIC src)
321321
set_target_properties(pytorch_qnnpack PROPERTIES PUBLIC_HEADER include/pytorch_qnnpack.h)
322-
set_target_properties(pytorch_qnnpack PROPERTIES PUBLIC_HEADER include/conv_utils.h)
323322
set_target_properties(pytorch_qnnpack PROPERTIES PUBLIC_HEADER include/qnnpack_func.h)
324323

325324
# ---[ Configure clog

aten/src/ATen/native/quantized/cpu/qnnpack/include/conv_utils.h

Lines changed: 0 additions & 268 deletions
This file was deleted.

aten/src/ATen/native/quantized/cpu/qnnpack/include/pytorch_qnnpack.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include <stdint.h>
1414

1515
#include <pthreadpool.h>
16+
#include <qnnpack/log.h>
17+
#include <qnnpack/operator.h>
1618

1719
#ifdef __cplusplus
1820
extern "C" {

aten/src/ATen/native/quantized/cpu/qnnpack/include/qnnpack_func.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
2-
#include <conv_utils.h>
2+
3+
#include <cstdlib>
34

45
namespace qnnpack {
56
class PrePackConvWeights final {

aten/src/ATen/native/quantized/cpu/qnnpack/src/conv-prepack.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#include <conv_utils.h>
1+
#include <pytorch_qnnpack.h>
2+
#include <qnnpack/log.h>
23
#include <qnnpack/pack.h>
34
#include <qnnpack_func.h>
45
#include <cstring>

aten/src/ATen/native/quantized/cpu/qnnpack/src/conv-run.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#include <conv_utils.h>
21
#include <qnnpack/indirection.h>
2+
#include <qnnpack/log.h>
3+
#include <qnnpack/operator.h>
34
#include <qnnpack/pack.h>
45
#include <qnnpack_func.h>
56
#include <cstring>

0 commit comments

Comments
 (0)
0