[inductor] Separate to_{dtype,device} from lowering to avoid copying (#107640)
These lowerings must copy even when they are no-ops in order to preserve
correctness in the presense of mutations. However, `to_dtype` and `to_device`
are also used in various lowerings as a helper function where it is okay to alias.
So, I've split these into two functions and allow the helper functions to alias
which saves some unnecessary copies.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/107640
Approved by: https://github.com/lezcano