lightning-thunder icon indicating copy to clipboard operation
lightning-thunder copied to clipboard

multiple in-place ops to func's arg tensors that are a view of another

Open crcrpar opened this issue 1 year ago • 1 comments

          Looks good to me, I wonder if we want a note about aliases as args?
def f(a, b):
    return a.exp_().sin_() + b.exp_().sin_()

a = torch.randn(5, 5)
f(a, a)

Originally posted by @t-vi in https://github.com/Lightning-AI/lightning-thunder/pull/723#pullrequestreview-2165267499

rel: #657

cc @apaz-cli

crcrpar avatar Jul 09 '24 17:07 crcrpar

What's the reliable way in PyTorch to determine if two tensors are each other's aliases?

At cache retrieval time can we quickly find which input tensors are aliased to each other, specialize traces on that and add this information to TensorProxies to be used in transforms?

IvanYashchuk avatar Jul 15 '24 07:07 IvanYashchuk