artyom-beilis/pytorch_dlprim

DLPrimitives/OpenCL out of tree backend for pytorch

What it solves

It provides an OpenCL backend for PyTorch, allowing users to run and train neural networks on a wider variety of hardware devices (including AMD, Nvidia, and Intel GPUs) that may not have native CUDA support.

How it works

The project implements an "out-of-tree" backend based on the dlprimitives library, which handles the actual operator implementations. By importing the pytorch_ocl package, users can target their OpenCL-compatible devices using the device string ocl (or privateuseone for older PyTorch versions) instead of cuda.

Who it’s for

Developers and researchers who want to utilize OpenCL-compatible GPUs from various vendors (AMD, Intel, Nvidia) for PyTorch workloads, particularly for vision-based networks.

Highlights

  • Broad Hardware Support: Tested on AMD (RX 6600XT, RX 560), Nvidia (GTX 960), and Intel (HD 530, UHD 770, Arc A380) devices.
  • Vision Network Validation: Validated against CPU references for a wide range of torchvision models, including ResNet, MobileNet, EfficientNet, and ViT.
  • PyTorch Compatibility: Supports PyTorch versions 1.13 and 2.4+.
  • Dedicated API: Includes specific functions for memory management and synchronization, such as torch.ocl.empty_cache() and torch.ocl.synchronize().

Related

  • Project
  • Project
  • Project
  • Project