pytorch/test/cpp_extensions
Sebastian Messmer 86b1afa039 Assert that kernels are called with the right signature (#40251)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/40251

Rather than segfaulting, we should show a good error message when in op.call<Return, Args...>(...) the Return type or Args types mismatch the kernel.

This adds an assertion comparing two std::type_index to the call path, but that should be fast. Hashing the function signature is also in the call path and not strictly constexpr, but I checked on godbolt that GCC >=5 and Clang >=3.8 optimize it away and make it constexpr, i.e. it's not part of the assembly.
ghstack-source-id: 106194240

Test Plan: waitforsandcastle

Differential Revision: D22126701

fbshipit-source-id: 6c908a822e295757bcc0014f78f51e6a560f221f
2020-06-18 21:54:05 -07:00
..
no_python_abi_suffix_test Allow building libraries with setuptools that dont have abi suffix (#14130) 2018-11-27 17:35:53 -08:00
self_compiler_include_dirs_test allow user passing relative paths in include_dirs within setuptools.setup (#38264) 2020-05-13 20:00:12 -07:00
torch_test_cpp_extension Add support for dotted names in CPP Extensions (#6986) 2018-04-29 18:10:03 +02:00
cpp_c10d_extension.cpp add c10d dynamic loading mechanism and unit test (#28068) 2020-04-02 15:46:51 -07:00
cpp_c10d_extension.hpp add c10d dynamic loading mechanism and unit test (#28068) 2020-04-02 15:46:51 -07:00
cpp_frontend_extension.cpp Better tests/support for Python/C++ inter-op (#15193) 2018-12-14 08:42:10 -08:00
cuda_extension_kernel.cu Improve CUDA extension support (#5324) 2018-02-23 10:15:30 -05:00
cuda_extension_kernel2.cu Improve CUDA extension support (#5324) 2018-02-23 10:15:30 -05:00
cuda_extension.cpp Deprecate tensor.type() (#30281) 2019-12-05 10:55:34 -08:00
cuda_extension.cu Improve CUDA extension support (#5324) 2018-02-23 10:15:30 -05:00
cudnn_extension.cpp Use torch:: instead of at:: in all C++ APIs (#13523) 2018-11-06 14:32:25 -08:00
doubler.h Use torch:: instead of at:: in all C++ APIs (#13523) 2018-11-06 14:32:25 -08:00
extension.cpp allow user passing relative paths in include_dirs within setuptools.setup (#38264) 2020-05-13 20:00:12 -07:00
jit_extension.cpp Unify C++ API with C++ extensions (#11510) 2018-09-24 14:44:21 -07:00
jit_extension2.cpp Unify C++ API with C++ extensions (#11510) 2018-09-24 14:44:21 -07:00
msnpu_extension.cpp Assert that kernels are called with the right signature (#40251) 2020-06-18 21:54:05 -07:00
rng_extension.cpp Prerequisites for CSPRNG (#36631) 2020-04-24 12:25:37 -07:00
setup.py allow user passing relative paths in include_dirs within setuptools.setup (#38264) 2020-05-13 20:00:12 -07:00