Commit Graph

6 Commits

Author SHA1 Message Date
Jane Xu
71ca600af9 Renaming CAFFE2_API to TORCH_API (#49496)
Summary:
Since caffe2 and torch have been consolidated, CAFFE2_API should be merged with TORCH_API. Addresses a TODO.

Manually edited some references of the removed `CAFFE2_API`:
* `CONTRIBUTING.md`
* `caffe2/proto/CMakeLists.txt`
* `cmake/ProtoBuf.cmake`
* `c10/macros/Export.h`
* `torch/csrc/WindowsTorchApiMacro.h`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/49496

Reviewed By: malfet, samestep

Differential Revision: D25600726

Pulled By: janeyx99

fbshipit-source-id: 7e068d959e397ac183c097d7e9a9afeca5ddd782
2020-12-18 10:54:50 -08:00
Sean Lynch
f73e32cd04 Reduce amount of work done within a global lock within ParallelLoadOp (#43508)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/43508

Differential Revision: D22952007

fbshipit-source-id: 11e28d20175271e6068edce8cb36f9fcf867a02a
2020-08-26 18:19:40 -07:00
Edward Yang
a5b1f6e7d7 Add missing _API definitions. (#30310)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30310

- Annotate CUDAGenerator.h with correct TORCH_CUDA_API.
  This is actually CUDA related functionality with its implementation living
  in the cuda/ folder.  For some reason it lives at the top level; it
  should be moved (but that should be handled in another PR.)
- Add missing TORCH/CAFFE_API annotations to.  All of
  these functions are used from CUDA code, which means that
  we need to correctly annotate them if we split CPU/CUDA code
  into separate libraries.

Test Plan: Imported from OSS

Differential Revision: D18762357

Pulled By: ezyang

fbshipit-source-id: c975a8e4f082fe9f4196c2cca40977623caf4148
2019-12-03 10:46:32 -08:00
Junjie Bai
352731bd6e Revert D18632773: Split libtorch.so back into libtorch_{cpu,cuda,hip}
Test Plan: revert-hammer

Differential Revision:
D18632773

Original commit changeset: ea717c81e0d7

fbshipit-source-id: 18601439f9f81c9f389020e5a0e4e04adb21772d
2019-11-21 15:01:09 -08:00
Edward Yang
ec30d9028a Split libtorch.so back into libtorch_{cpu,cuda,hip} (#29731)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29731

The new structure is that libtorch_cpu contains the bulk of our
code, and libtorch depends on libtorch_cpu and libtorch_cuda.

Some subtleties about the patch:
- There were a few functions that crossed CPU-CUDA boundary without API macros. I just added them, easy enough. An inverse situation was aten/src/THC/THCTensorRandom.cu where we weren't supposed to put API macros directly in a cpp file.
- DispatchStub wasn't getting all of its symbols related to static members on DispatchStub exported properly. I tried a few fixes but in the end I just moved everyone off using DispatchStub to dispatch CUDA/HIP (so they just use normal dispatch for those cases.) Additionally, there were some mistakes where people incorrectly were failing to actually import the declaration of the dispatch stub, so added includes for those cases.
- torch/csrc/cuda/nccl.cpp was added to the wrong list of SRCS, now fixed (this didn't matter before because previously they were all in the same library)
- The dummy file for libtorch was brought back from the dead; it was previously deleted in #20774
- In an initial version of the patch, I forgot to make torch_cuda explicitly depend on torch_cpu. This lead to some very odd errors, most notably "bin/blob_test: hidden symbol `_ZNK6google8protobuf5Arena17OnArenaAllocationEPKSt9type_infom' in lib/l
ibprotobuf.a(arena.cc.o) is referenced by DSO"
- A number of places in Android/iOS builds have to add torch_cuda explicitly as a library, as they do not have transitive dependency calculation working correctly. This situation also happens with custom C++ extensions.
- There's a ROCm compiler bug where extern "C" on functions is not respected. There's a little workaround to handle this.
- Because I was too lazy to check if HIPify was converting TORCH_CUDA_API into TORCH_HIP_API, I just made it so HIP build also triggers the TORCH_CUDA_API macro. Eventually, we should translate and keep the nature of TORCH_CUDA_API constant in all cases.

Fixes #27215 (as our libraries are smaller), and executes on
part of the plan in #29235.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

Test Plan: Imported from OSS

Differential Revision: D18632773

Pulled By: ezyang

fbshipit-source-id: ea717c81e0d7554ede1dc404108603455a81da82
2019-11-21 11:27:33 -08:00
Chunli Fu
58ee61176c SeqBlobReader Implementation (#29888)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29888

Extract some common functions out of class LoadOp.

Reviewed By: yinghai, ipiszy

Differential Revision: D18456785

fbshipit-source-id: d0b8e86ad5709c35f1dc3821376000db1114dc95
2019-11-16 01:18:54 -08:00