
Now I implemented only handful of ops and mostly for forward computations: GitHub - artyom-beilis/pytorch_dlprim: DLPrimitives-OpenCL out of tree backend for pytorch but I managed to do computations and get correct result on pretrained alexnet.
OPENCL BENCHMARK GTX 960 MANUAL
Another item that is missing from this manual about out-of-source backends Extending dispatcher for a new backend in C++ - PyTorch Tutorials 1.9.1+cu102 documentation is need to implement c10::impl::DeviceGuardImplInterface and register it via c10::impl::DeviceGuardImplRegistrar.I found that decpide the suggestion to use these dispatch key I need to have device mapped to it and it is impossible to do without modifications of pytorch sources: Set temporary opencl device to PrivateUse1 dispatch key Currently it is only change I needed to start working on out-of-tree backend. I changed mapping of opencl device to PirvateUse1 dispatch key just to be able to do anything.TL DR: I managed to run inference of alexnet using OpenCL/DLPrimitives based pytorch backend! P.S.: Disclaimer: I am just a random person on the internet and not anyone who has any say whether PyTorch would accept an OpenCL backend if it were there. Quite likely the autograd support might not be as device dependent (but I didn’t try, obviously). Once you have that, you could tackle simple ops (y = x1 + x2). This would be the first thing to resolve. You could also take inspiration from the more recent vulkan backend (which, as far as I understand, is special purpose, but recently and also eyes APUs etc.). File a bug describing what you were doing if you think this is in error.Īfter you fix this, you’ll likely bump into the next. This is a grandfathered Caffe2 device type opencl, it shouldn't ever convert to a DispatchKey. This gives you RuntimeError: 0INTERNAL ASSERT FAILED at "./c10/core/TensorOptions.h":655, please report a bug to PyTorch. If you wanted to pull this off (it will be quite some undertaking), you could start with your own build and do torch.ones(5,5, device="opencl") You likely want to tackle the first before the second becomes your main problem. the operator coverage (where you have a head start, apparently).PyTorch has quite some infrastructure (the dispatcher, see e.g.In my view, the difficulty in bootstrapping a new architecture is twofold:
