Skip to content

Commit 17a3d54

Browse files
add foreach backend test selection
1 parent 098130d commit 17a3d54

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/config.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@ def is_supported(self, device: DeviceType) -> bool:
5757
# Triton requires GPU/XPU
5858
if not (torch.cuda.is_available() or (hasattr(torch, "xpu") and torch.xpu.is_available())):
5959
return False
60+
if self == Backend.foreach:
61+
# skip foreach on CPU
62+
if device == DeviceType.cpu:
63+
return False
64+
# forach has limited support on MPS/XPU
65+
if (hasattr(torch.backends, "mps") and torch.backends.mps.is_available()) or (
66+
hasattr(torch, "xpu") and torch.xpu.is_available()
67+
):
68+
return False
69+
# foreach wors best on CUDA devices
70+
if not torch.cuda.is_available():
71+
return False
6072
return True
6173

6274

0 commit comments

Comments
 (0)