pytorch/tools/codegen
Brian Hirsh a7ddd15d15 fix static dispatch linker error (#53859)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53859

The redispatch API wasn't linking properly when static dispatch is enabled. I'm still not sure why this wasn't caught by the static dispatch test in CI- maybe, as swolchok pointed out, we have a flag set somewhere that defers undefined symbols until runtime.

Before, building with static dispatch enabled locally + running `import torch` gave me this error:
```
>>> import torch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/raid/hirsheybar/pytorch/torch/__init__.py", line 197, in <module>
    from torch._C import *
ImportError: /raid/hirsheybar/pytorch/torch/lib/libtorch_cpu.so: undefined symbol: _ZN2at10redispatch11logical_or_EN3c1014DispatchKeySetERNS_6TensorERKS3_
>>>
```

Printing the symbol:
```
(pytorch) hirsheybar@devfair017:/scratch/hirsheybar/pytorch$ c++filt _ZN2at10redispatch11logical_or_EN3c1014DispatchKeySetERNS_6TensorERKS3_
at::redispatch::logical_or_(c10::DispatchKeySet, at::Tensor&, at::Tensor const&)
```

Sure enough, the functions defined in `RedispatchFunctions.cpp` don't have the DispatchKeySet argument included. Adding them in this PR.

Test Plan: Imported from OSS

Reviewed By: ljk53

Differential Revision: D26998735

Pulled By: bdhirsh

fbshipit-source-id: c6c1104e42d13b7ec9d964b7e08d2adc8b344b78
2021-03-12 09:41:08 -08:00
..
api Move view handling logic to gen_inplace_or_view_type.py (#53341) 2021-03-11 21:25:15 -08:00
dest skip dispatch in resize_ (#53575) 2021-03-10 17:06:35 -08:00
selective_build [PyTorch Mobile] Generate Kernel dtype selection code in selected_mobile_ops.h during the build (#49279) 2021-01-06 12:17:32 -08:00
__init__.py Rewrite of ATen code generator (#42629) 2020-08-31 09:00:22 -07:00
code_template.py Rewrite of ATen code generator (#42629) 2020-08-31 09:00:22 -07:00
context.py Split out RegisterDispatchKey to its own file (#51508) 2021-02-04 09:19:32 -08:00
gen.py fix static dispatch linker error (#53859) 2021-03-12 09:41:08 -08:00
local.py Byte-for-byte compatibility fixes in codegen (#44879) 2020-09-25 08:06:50 -07:00
model.py Split out RegisterDispatchKey to its own file (#51508) 2021-02-04 09:19:32 -08:00
utils.py Split anonymous and namespaced definitions in RegisterDispatchKey (#51585) 2021-02-04 09:19:41 -08:00