[pytorch] bump up variable version regardless of differentiability (#41269)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/41269
The ultimate goal is to move things that are not gated with `if (compute_requires_grad(...))`
or `if (grad_fn)` out from VariableType so that VariableType kernels can be enabled/disabled
based upon `GradMode`. Then we can merge `AutoNonVariableTypeMode` and `NoGradGuard`.
We've moved profiling / tracing logic out from VariableType. One remaining thing that's
not gated with the if-statement is the `increment_version` call.
However, the `gen_variable_type.py` does use bits from `derivatives.yaml` to determine whether
to emit the `increment_version` call. If an output is never going to be differentiable (not based
upon runtime property of the variable but based upon static property, e.g. it's integral type)
then it would never emit the increment_version call.
Hypothetically, increment_version for a tensor can be orthogonal to its differentiability.
This PR is to make the change and test its impact. Making this logical simplification would
allow us to move this out from VariableType to aten codegen.
ghstack-source-id: 108318746
Test Plan: CI
Reviewed By: ezyang
Differential Revision: D22471643
fbshipit-source-id: 3e3a442c7fd851641eb4a9c4f024d1f5438acdb8