Closed kehuanfeng closed 1 year ago
The forward of my model does contain the opeation of explict cuda mem copy, that's why it requires to retrieve cuda stream.
You code indirectly call these ops which doesn't return Tensor. I think it's not hard to support these functions. I can take a look if you have a repro.
@yanboliang Thanks for the reply. You can use the following mini repo. Additionally, there should be similar request for torch.cuda.device.
import torch
import torch.nn as nn
import torch._dynamo as dynamo
from torch.nn.parallel._functions import _get_stream
class CopyModel(nn.Module):
def __init__(self):
super(CopyModel, self).__init__()
def forward(self, input, device):
self.copy_stream = torch.cuda.Stream(device)
with torch.cuda.stream(self.copy_stream):
return input.cuda()
model = CopyModel()
output = model(torch.rand(1000), 1)
print(output.get_device())
opt_model = dynamo.optimize('eager')(model)
output = opt_model(torch.rand(1000), 1)
print(output.get_device())
Closing it as it works with pytorch nightly build
🐛 Describe the bug
I tried to compile my model and got the following error. The error message is kind of straightforward, as the builder doesn't have the proper variable kind for torch.cuda.Stream. The forward of my model does contain the opeation of explict cuda mem copy, that's why it requires to retrieve cuda stream.
Error logs
No response
Minified repro
No response