Skip to content

Commit 68e62b9

Browse files
Ilia Cherniavskiifacebook-github-bot
authored andcommitted
Use TensorMethods.cpp (#37639)
Summary: Pull Request resolved: #37639 Changing TensorMethods.h to .cpp Necessary to avoid incomplete types in dispatcher Test Plan: CI Imported from OSS checked mobile size, no change, small reduction in size in fbios fbios: Succeeded Change in Download Size for arm64 + 3x assets variation: -18.2 KiB Change in Uncompressed Size for arm64 + 3x assets variation: -8.8 KiB reran benchmark, no stat. significant difference buck run mode/opt caffe2/caffe2/fb/high_perf_models/pytorch/benchmark_framework_overheads:benchmark_torchscript_model -- --model_file caffe2/caffe2/fb/high_perf_models/pytorch/benchmark_framework_overheads/addmodule.pt --num_runs 3 ╷ @ 68592d0d 41 minutes ago iliacher D21374247 ╭─╯ Use TensorMethods.cpp Created 3 benchmark runs on aibench for caffe2/caffe2/fb/high_perf_models/pytorch/benchmark_framework_overheads/addmodule.pt. Links to the results: * Adhoc run: https://our.intern.facebook.com/intern/aibench/details/1729113760 * Adhoc run: https://our.intern.facebook.com/intern/aibench/details/3867976782 * Adhoc run: https://our.intern.facebook.com/intern/aibench/details/2782186766 hg prev @ 7f501b42 Thursday at 14:26 bvaughan D21764704 ╷ short-circuit pow for complex 1 and 0 exponents Created 3 benchmark runs on aibench for caffe2/caffe2/fb/high_perf_models/pytorch/benchmark_framework_overheads/addmodule.pt. Links to the results: * Adhoc run: https://our.intern.facebook.com/intern/aibench/details/2155256332 * Adhoc run: https://our.intern.facebook.com/intern/aibench/details/1802057074 * Adhoc run: https://our.intern.facebook.com/intern/aibench/details/4119590830 Differential Revision: D21374247 fbshipit-source-id: 076964415079cf84fb57f1f7b43d087afed86e1d
1 parent f872cf5 commit 68e62b9

19 files changed

Lines changed: 93 additions & 93 deletions

BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ genrule(
140140
"aten/src/ATen/TypeDefault.h",
141141
"aten/src/ATen/TypeDefault.cpp",
142142
"aten/src/ATen/core/TensorBody.h",
143-
"aten/src/ATen/core/TensorMethods.h",
143+
"aten/src/ATen/core/TensorMethods.cpp",
144144
"aten/src/ATen/core/ATenOpList.cpp",
145145
],
146146
cmd = "$(location :gen) --source-path aten/src/ATen --install_dir `dirname $(location aten/src/ATen/Declarations.yaml)` aten/src/ATen/Declarations.cwrap aten/src/THCUNN/generic/THCUNN.h aten/src/ATen/nn.yaml aten/src/ATen/native/native_functions.yaml",

aten/src/ATen/Tensor.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
11
#pragma once
22

3-
/*
4-
* We split Tensor.h into TensorBody.h and TensorMethods.h because we want
5-
* all TensorMethods to be inlined, but they depend on the Dispatcher,
6-
* which in turn depends on many other things, which then depend back on Tensor.
7-
*
8-
* We can break this dependency chain by having the dispatcher only depend on
9-
* TensorBody.h and not TensorMethods.h.
10-
*/
113
#include <ATen/core/TensorBody.h>
12-
#include <ATen/core/TensorMethods.h>

aten/src/ATen/core/Tensor.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
11
#pragma once
22

3-
/*
4-
* We split Tensor.h into TensorBody.h and TensorMethods.h because we want
5-
* all TensorMethods to be inlined, but they depend on the Dispatcher,
6-
* which in turn depends on many other things, which then depend back on Tensor.
7-
*
8-
* We can break this dependency chain by having the dispatcher only depend on
9-
* TensorBody.h and not TensorMethods.h.
10-
*/
113
#include <ATen/core/TensorBody.h>
12-
#include <ATen/core/TensorMethods.h>

aten/src/ATen/core/boxing/impl/kernel_function_legacy_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <ATen/core/Tensor.h>
1010
#include <torch/csrc/jit/frontend/function_schema_parser.h>
1111

12+
#include <ATen/core/LegacyTypeDispatch.h>
13+
1214
/**
1315
* This file tests the legacy function-based API for registering kernels.
1416
*

aten/src/ATen/core/boxing/impl/kernel_function_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include <ATen/core/Tensor.h>
66
#include <torch/csrc/jit/frontend/function_schema_parser.h>
77

8+
#include <ATen/core/LegacyTypeDispatch.h>
9+
810
using c10::RegisterOperators;
911
using c10::DispatchKey;
1012
using c10::Stack;

aten/src/ATen/core/boxing/impl/kernel_lambda_legacy_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <ATen/core/Tensor.h>
1010
#include <torch/csrc/jit/frontend/function_schema_parser.h>
1111

12+
#include <ATen/core/LegacyTypeDispatch.h>
13+
1214
/**
1315
* This file tests the legacy lambda-based API for registering kernels:
1416
*

aten/src/ATen/core/boxing/impl/kernel_lambda_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include <ATen/core/Tensor.h>
66
#include <torch/csrc/jit/frontend/function_schema_parser.h>
77

8+
#include <ATen/core/LegacyTypeDispatch.h>
9+
810
using c10::RegisterOperators;
911
using c10::DispatchKey;
1012
using c10::Stack;

aten/src/ATen/core/boxing/impl/kernel_stackbased_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <ATen/core/Tensor.h>
77
#include <torch/csrc/jit/frontend/function_schema_parser.h>
88

9+
#include <ATen/core/LegacyTypeDispatch.h>
10+
911
using c10::RegisterOperators;
1012
using c10::DispatchKey;
1113
using c10::Stack;

aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include <ATen/core/Tensor.h>
66
#include <torch/csrc/jit/frontend/function_schema_parser.h>
77

8+
#include <ATen/core/LegacyTypeDispatch.h>
9+
810
using c10::RegisterOperators;
911
using c10::OperatorKernel;
1012
using c10::DispatchKey;

aten/src/ATen/core/op_registration/op_registration_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include <ATen/core/Tensor.h>
1717
#include <functional>
1818

19+
#include <ATen/core/LegacyTypeDispatch.h>
20+
1921
using c10::RegisterOperators;
2022
using c10::OperatorKernel;
2123
using c10::OperatorHandle;

0 commit comments

Comments
 (0)