microsoft / DirectML

DirectML is a high-performance, hardware-accelerated DirectX 12 library for machine learning. DirectML provides GPU acceleration for common machine learning tasks across a broad range of supported hardware and drivers, including all DirectX 12-capable GPUs from vendors such as AMD, Intel, NVIDIA, and Qualcomm.
MIT License
2.23k stars 298 forks source link

Could not run 'aten::_embedding_bag' on RX 6900 XT #193

Closed zasyadko closed 2 years ago

zasyadko commented 2 years ago

I tried torch tutorial with DML and got an issue with TransformerEncoder layer. On CPU all ok.

    self.embedding = nn.EmbeddingBag(vocab_size, embed_dim, sparse=True)

...

    embedded = self.embedding(text, offsets)

C:\Users\zasyadko\PycharmProjects\pytorchDMLtest\venv\Scripts\python.exe C:/Users/zasyadko/PycharmProjects/pytorchDMLtest/beginner_source/text_sentiment_ngrams_tutorial.py Traceback (most recent call last): File "C:/Users/zasyadko/PycharmProjects/pytorchDMLtest/beginner_source/text_sentiment_ngrams_tutorial.py", line 275, in train(train_dataloader) File "C:/Users/zasyadko/PycharmProjects/pytorchDMLtest/beginner_source/text_sentiment_ngrams_tutorial.py", line 198, in train predited_label = model(text, offsets) File "C:\Users\zasyadko\PycharmProjects\pytorchDMLtest\venv\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "C:/Users/zasyadko/PycharmProjects/pytorchDMLtest/beginner_source/text_sentiment_ngrams_tutorial.py", line 155, in forward embedded = self.embedding(text, offsets) File "C:\Users\zasyadko\PycharmProjects\pytorchDMLtest\venv\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(input, **kwargs) File "C:\Users\zasyadko\PycharmProjects\pytorchDMLtest\venv\lib\site-packages\torch\nn\modules\sparse.py", line 326, in forward return F.embedding_bag(input, self.weight, offsets, File "C:\Users\zasyadko\PycharmProjects\pytorchDMLtest\venv\lib\site-packages\torch\nn\functional.py", line 2088, in embeddingbag ret, , , = torch.embedding_bag( RuntimeError: Could not run 'aten::_embedding_bag' with arguments from the 'UNKNOWN_TENSOR_TYPE_ID' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'aten::_embedding_bag' is only available for these backends: [CPU, BackendSelect, Named, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradNestedTensor, UNKNOWN_TENSOR_TYPE_ID, AutogradPrivateUse1, AutogradPrivateUse2, AutogradPrivateUse3, Tracer, Autocast, Batched, VmapMode].

CPU: registered at D:\a_work\1\s\build\aten\src\ATen\RegisterCPU.cpp:5926 [kernel] BackendSelect: fallthrough registered at D:\a_work\1\s\aten\src\ATen\core\BackendSelectFallbackKernel.cpp:3 [backend fallback] Named: registered at D:\a_work\1\s\aten\src\ATen\core\NamedRegistrations.cpp:7 [backend fallback] AutogradOther: registered at D:\a_work\1\s\torch\csrc\autograd\generated\VariableType_0.cpp:9273 [autograd kernel] AutogradCPU: registered at D:\a_work\1\s\torch\csrc\autograd\generated\VariableType_0.cpp:9273 [autograd kernel] AutogradCUDA: registered at D:\a_work\1\s\torch\csrc\autograd\generated\VariableType_0.cpp:9273 [autograd kernel] AutogradXLA: registered at D:\a_work\1\s\torch\csrc\autograd\generated\VariableType_0.cpp:9273 [autograd kernel] AutogradNestedTensor: registered at D:\a_work\1\s\torch\csrc\autograd\generated\VariableType_0.cpp:9273 [autograd kernel] UNKNOWN_TENSOR_TYPE_ID: registered at D:\a_work\1\s\torch\csrc\autograd\generated\VariableType_0.cpp:9273 [autograd kernel] AutogradPrivateUse1: registered at D:\a_work\1\s\torch\csrc\autograd\generated\VariableType_0.cpp:9273 [autograd kernel] AutogradPrivateUse2: registered at D:\a_work\1\s\torch\csrc\autograd\generated\VariableType_0.cpp:9273 [autograd kernel] AutogradPrivateUse3: registered at D:\a_work\1\s\torch\csrc\autograd\generated\VariableType_0.cpp:9273 [autograd kernel] Tracer: registered at D:\a_work\1\s\torch\csrc\autograd\generated\TraceType_0.cpp:10499 [kernel] Autocast: fallthrough registered at D:\a_work\1\s\aten\src\ATen\autocast_mode.cpp:250 [backend fallback] Batched: registered at D:\a_work\1\s\aten\src\ATen\BatchingRegistrations.cpp:1016 [backend fallback] VmapMode: fallthrough registered at D:\a_work\1\s\aten\src\ATen\VmapModeRegistrations.cpp:33 [backend fallback]

Process finished with exit code 1

Adele101 commented 2 years ago

Thanks for your submission! We are actively adding new operator support to PyTorch-DML, so thank you for your patience and being one of our early users. Please visit the PyTorch-DirectML Operator Roadmap for guidance on current and future support.