haystack icon indicating copy to clipboard operation
haystack copied to clipboard

Needs support XPU

Open strcom opened this issue 9 months ago • 1 comments

Now haystack supports only devices:

https://github.com/deepset-ai/haystack/blob/main/haystack/utils/device.py

    CPU = "cpu"
    GPU = "cuda"
    DISK = "disk"
    MPS = "mps"

But the list of supported devices (for example in torch) includes:

https://pytorch.org/docs/stable/xpu.html

XPU

Naturally, the list of supported devices in torch is even wider.

Proposed modification (minimal) to include support for XPU (intel GPU):

class DeviceType(Enum):
    """
    Represents device types supported by Haystack.

    This also includes devices that are not directly used by models - for example, the disk device is exclusively used
    in device maps for frameworks that support offloading model weights to disk.
    """

    CPU = "cpu"
    GPU = "cuda"
    DISK = "disk"
    MPS = "mps"
    XPU = "xpu" # THIS IS NEW DEVICE SUPPORT

    def __str__(self):
        return self.value

Or load supported devices by torch dynamically, if it possible.

strcom avatar Mar 14 '25 11:03 strcom

Hello @strcom and thank you for your suggestion! @sjrl and I briefly discussed the proposed modification that extends the DeviceType Enum and we like it. (Loading supported devices by torch dynamically is not our preference because new devices types don't need to be added often.) Would you be interested in opening a PR yourself? I assume you have a Intel GPU at hand to test the proposed modification? Here are simple contributing guidelines.

julian-risch avatar Mar 14 '25 15:03 julian-risch