pytorch/tools/codegen
Edward Yang b4f5efa7b2 Structured kernels generate Meta registrations (#48116)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/48116

If you port kernels to be structured, you get Meta kernels automatically
generated for you.  This is one payoff of structured kernels.

Code generation was mercifully really simple, although at risk of
"swiss cheese" syndrome: there's two new conditionals in the codegen
to tweak behavior when generating for meta keys.  It's not too bad
right now but there's a risk of things getting out of hand.  One
way to rationalize the logic here would be to transmit "TensorMeta-ness"
inside the TensorOptions (so tensor_from_meta can deal with it); then
the "Meta" kernel magic would literally just be generating empty
out_impls to call after all the scaffolding is done.  But I didn't
do this because it seemed like it would be more annoying short term.

Also had to teach resize_ to work on meta tensors, since we use them
to implement the out kernels.

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

Test Plan: Imported from OSS

Reviewed By: bhosmer, ailzhang

Differential Revision: D25056640

Pulled By: ezyang

fbshipit-source-id: f8fcfa0dbb58a94d9b4196748f56e155f83b1521
2020-12-02 07:54:48 -08:00
..
api [pytorch][codegen] add autograd data model (#48249) 2020-11-19 21:47:05 -08:00
selective_build [RFC] Switch PyTorch Selective Build (Custom Build) to use the SelectiveBuilder abstraction (#45722) 2020-10-18 15:10:42 -07:00
__init__.py
code_template.py
gen.py Structured kernels generate Meta registrations (#48116) 2020-12-02 07:54:48 -08:00
local.py Byte-for-byte compatibility fixes in codegen (#44879) 2020-09-25 08:06:50 -07:00
model.py [pytorch][codegen] add autograd data model (#48249) 2020-11-19 21:47:05 -08:00
utils.py [pytorch][codegen] add autograd data model (#48249) 2020-11-19 21:47:05 -08:00