8000 [nativert] Address tooling setup for torch/nativert/ (#153164) · pytorch/pytorch@9608e7f · GitHub
[go: up one dir, main page]

Skip to content

Commit 9608e7f

Browse files
zhxchen17pytorchmergebot
authored andcommitted
[nativert] Address tooling setup for torch/nativert/ (#153164)
Summary: As discussed with @malfet , we're porting nativert code to torch/nativert/. Following up some concerns over the new directory, I'm trying to setup the tooling on OSS so various things (like linters) can run on torch/nativert/ properly. Test Plan: CI Differential Revision: D74407808 Pull Request resolved: #153164 Approved by: https://github.com/dolpm, https://github.com/Skylion007
1 parent e820b05 commit 9608e7f

File tree

3 files 8000 changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

.lintrunner.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ include_patterns = [
8484
'torch/csrc/**/*.h',
8585
'torch/csrc/**/*.hpp',
8686
'torch/csrc/**/*.cpp',
87+
'torch/nativert/**/*.h',
88+
'torch/nativert/**/*.cpp',
8789
'test/cpp/**/*.h',
8890
'test/cpp/**/*.cpp',
8991
]
@@ -232,6 +234,10 @@ include_patterns = [
232234
'torch/csrc/**/*.cpp',
233235
'torch/csrc/jit/serialization/*.h',
234236
'torch/csrc/jit/serialization/*.cpp',
237+
'torch/nativert/*.h',
238+
'torch/nativert/*.cpp',
239+
'torch/nativert/**/*.h',
240+
'torch/nativert/**/*.cpp',
235241
]
236242
exclude_patterns = [
237243
# The negative filters below are to exclude files that include onnx_pb.h or
@@ -533,6 +539,7 @@ include_patterns = [
533539
'c10/**',
534540
'aten/**',
535541
'torch/csrc/**',
542+
'torch/nativert/**',
536543
]
537544
exclude_patterns = [
538545
'aten/src/ATen/native/quantized/cpu/qnnpack/**',
@@ -760,6 +767,7 @@ include_patterns = [
760767
'aten/**',
761768
'c10/**',
762769
'torch/csrc/**',
770+
'torch/nativert/**',
763771
]
764772
exclude_patterns = [
765773
'aten/src/ATen/cuda/CUDAContext.cpp',
@@ -1014,6 +1022,7 @@ include_patterns = [
10141022
'c10/**',
10151023
'aten/**',
10161024
'torch/csrc/**',
1025+
'torch/nativert/**',
10171026
]
10181027
exclude_patterns = [
10191028
'c10/util/CallOnce.h',
@@ -1058,6 +1067,7 @@ include_patterns = [
10581067
'c10/**',
10591068
'aten/**',
10601069
'torch/csrc/**',
1070+
'torch/nativert/**',
10611071
]
10621072
exclude_patterns = [
10631073
'**/fb/**',

torch/nativert/graph/TensorMeta.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,16 @@ c10::Layout convertJsonLayout(const torch::_export::Layout& layout) {
9292
c10::Device convertJsonDevice(const torch::_export::Device& device) {
9393
c10::Device d(device.get_type());
9494
if (auto index = device.get_index()) {
95-
d.set_index(*index);
95+
d.set_index(static_cast<at::DeviceIndex>(*index));
9696
}
9797
return d;
9898
}
9999

100100
TensorMeta::TensorMeta(const torch::_export::TensorMeta& tensorMeta)
101-
: device_(convertJsonDevice(tensorMeta.get_device())) {
102-
dtype_ = convertJsonScalarType(tensorMeta.get_dtype());
103-
layout_ = convertJsonLayout(tensorMeta.get_layout());
104-
requiresGrad_ = tensorMeta.get_requires_grad();
105-
101+
: dtype_(convertJsonScalarType(tensorMeta.get_dtype())),
102+
layout_(convertJsonLayout(tensorMeta.get_layout())),
103+
requiresGrad_(tensorMeta.get_requires_grad()),
104+
device_(convertJsonDevice(tensorMeta.get_device())) {
106105
if (tensorMeta.get_storage_offset().tag() ==
107106
torch::_export::SymInt::Tag::AS_INT) {
108107
storage_offset_ = tensorMeta.get_storage_offset().get_as_int();

torch/nativert/graph/TensorMeta.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
#include <c10/core/Device.h>
44
#include <c10/util/Logging.h>
55

6+
#include <c10/core/Layout.h>
67
#include <c10/core/MemoryFormat.h>
78
#include <c10/core/ScalarType.h>
89
#include <c10/core/TensorOptions.h>
9-
#include "c10/core/Layout.h"
1010
#include <c10/util/ArrayRef.h>
1111

1212
#include <torch/csrc/utils/generated_serialization_types.h>

0 commit comments

Comments
 (0)
0