Commit Graph

2 Commits

Author SHA1 Message Date
Gao, Xiang
a1f9a3c643 Fix UB in library.h (#57962)
Summary:
The function name and return type both are called `class_`, therefore they are ambiguous and this is UB and does not work on NVCC. See the tests for the failure case.

Thanks for the help of Thibaut Lutz from NVIDIA's compiler team.

cc: yueyericardo ptrblck

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

Reviewed By: mruberry

Differential Revision: D28359400

Pulled By: ezyang

fbshipit-source-id: c64ec89203f99f656611aba34f7424eed7bc9e7c
2021-05-11 16:04:02 -07:00
Gao, Xiang
b12d645c2f Test TORCH_LIBRARY in CUDA extension (#47524)
Summary:
In the [official documentation](https://pytorch.org/tutorials/advanced/torch_script_custom_ops.html), it is recommended to use `TORCH_LIBRARY` to register ops for TorchScript. However, that code is never tested with CUDA extension and is actually broken (https://github.com/pytorch/pytorch/issues/47493). This PR adds a test for it. It will not pass CI now, but it will pass when the issue https://github.com/pytorch/pytorch/issues/47493 is fixed.

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

Reviewed By: zou3519

Differential Revision: D24991839

Pulled By: ezyang

fbshipit-source-id: 037196621c7ff9a6e7905efc1097ff97906a0b1c
2020-11-16 13:12:22 -08:00