Skip to content

Make data_ptr a method on Tensor#20878

Closed
li-roy wants to merge 4 commits intogh/li-roy/23/basefrom
gh/li-roy/23/head
Closed

Make data_ptr a method on Tensor#20878
li-roy wants to merge 4 commits intogh/li-roy/23/basefrom
gh/li-roy/23/head

Conversation

@li-roy
Copy link
Copy Markdown
Contributor

@li-roy li-roy commented May 23, 2019

Stack from ghstack:

Make this a method on Tensor rather than a native function. We don't have to support void* in c10 dispatcher, and we can stop blacklisting this in jit registry.

Differential Revision: D15482061

@pytorchbot pytorchbot added oncall: jit Add this issue/PR to JIT oncall triage queue module: internals Related to internal abstractions in c10 and ATen module: operators module: pybind Related to our Python bindings / interactions with other Python libraries labels May 23, 2019
@ezyang
Copy link
Copy Markdown
Contributor

ezyang commented May 28, 2019

Don't we have a data_ptr() method on the Python side? What's happening here?

@li-roy
Copy link
Copy Markdown
Contributor Author

li-roy commented May 28, 2019

We do, I'm just binding it manually like dim() and other methods on Tensor.

@dzhulgakov
Copy link
Copy Markdown
Collaborator

Just curious - what's the reason of not making it a native_function instead?

@li-roy
Copy link
Copy Markdown
Contributor Author

li-roy commented May 29, 2019

A couple reasons: it's method that's not a function, doesn't have backend specific dispatch, there's no reason it can't be a method directly on tensor like size() or data(). Another reason is it's the only native_function that uses void*, so moving it means we don't have to blacklist it in gen_jit_dispatch nor support it in c10 dispatcher.

Make data_ptr a method on Tensor

gh-metadata: pytorch pytorch 20878 gh/li-roy/23/head
@ezyang
Copy link
Copy Markdown
Contributor

ezyang commented May 29, 2019

Failures are legit.

❌ ci/circleci: caffe2_py2_system_macos10_13_build                        https://circleci.com/gh/pytorch/pytorch/1827721:
May 29 00:50:04 In file included from /Users/distiller/project/aten/src/TH/THTensorApply.h:4:
May 29 00:50:04 In file included from /Users/distiller/project/aten/src/ATen/Parallel.h:2:
May 29 00:50:04 In file included from /Users/distiller/project/aten/src/ATen/ATen.h:5:
May 29 00:50:04 In file included from /Users/distiller/project/aten/src/ATen/Context.h:4:
May 29 00:50:04 In file included from /Users/distiller/project/aten/src/ATen/Tensor.h:2:
May 29 00:50:04 /Users/distiller/project/aten/src/ATen/core/Tensor.h:257:41: error: no member named 'slow_data' in 'c10::TensorImpl'
May 29 00:50:04     return this->unsafeGetTensorImpl()->slow_data();
May 29 00:50:04            ~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^
May 29 00:50:05 1 error generated.
May 29 00:50:05 make[2]: *** [caffe2/CMakeFiles/caffe2.dir/__/aten/src/ATen/DLConvertor.cpp.o] Error 1
May 29 00:50:05 make[2]: *** Waiting for unfinished jobs....
May 29 00:50:05 1 error generated.
May 29 00:50:05 make[2]: *** [caffe2/CMakeFiles/caffe2.dir/__/aten/src/ATen/CPUGenerator.cpp.o] Error 1
May 29 00:50:05 1 error generated.
May 29 00:50:05 make[2]: *** [caffe2/CMakeFiles/caffe2.dir/__/aten/src/ATen/CPUTypeDefault.cpp.o] Error 1
May 29 00:50:06 1 error generated.
May 29 00:50:06 make[2]: *** [caffe2/CMakeFiles/caffe2.dir/__/aten/src/ATen/Context.cpp.o] Error 1
May 29 00:50:06 make[1]: *** [caffe2/CMakeFiles/caffe2.dir/all] Error 2

royboy added 2 commits May 29, 2019 11:03
Make data_ptr a method on Tensor

gh-metadata: pytorch pytorch 20878 gh/li-roy/23/head
Make data_ptr a method on Tensor

gh-metadata: pytorch pytorch 20878 gh/li-roy/23/head
@zou3519 zou3519 deleted the gh/li-roy/23/head branch May 30, 2019 18:50
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@li-roy merged this pull request in 313ef4f.

zdevito pushed a commit to zdevito/ATen that referenced this pull request May 30, 2019
Summary:
Pull Request resolved: pytorch/pytorch#20878
ghimport-source-id: f19993d97ecb8cfcd60b371d9ed49e3ad2e051c7

Differential Revision: D15482061

Pulled By: li-roy

fbshipit-source-id: c0563ce849fc3277e86a1a58bd384e38365786b2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged module: internals Related to internal abstractions in c10 and ATen module: pybind Related to our Python bindings / interactions with other Python libraries oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants