diff --git a/tornado-drivers/opencl/src/main/java/uk/ac/manchester/tornado/drivers/opencl/scheduler/OCLScheduler.java b/tornado-drivers/opencl/src/main/java/uk/ac/manchester/tornado/drivers/opencl/scheduler/OCLScheduler.java index d3563ff5b6..7f88208b14 100644 --- a/tornado-drivers/opencl/src/main/java/uk/ac/manchester/tornado/drivers/opencl/scheduler/OCLScheduler.java +++ b/tornado-drivers/opencl/src/main/java/uk/ac/manchester/tornado/drivers/opencl/scheduler/OCLScheduler.java @@ -31,8 +31,27 @@ public class OCLScheduler { - private static final String AMD_VENDOR = "Advanced Micro Devices"; - private static final String NVIDIA = "NVIDIA"; + /** + * Supported Vendors for specific Thread-Schedulers + */ + public enum SUPPORTED_VENDORS { + AMD("Advanced Micro Devices"), // + CODEPLAY("Codeplay"), // + INTEL("Intel"), // + NVIDIA("NVIDIA"), // + XILINX("Xilinx"); + + private String name; + + SUPPORTED_VENDORS(String name) { + this.name = name; + } + + String getName() { + return this.name; + } + } + private static final int NVIDIA_MAJOR_VERSION_GENERIC_SCHEDULER = 550; private static final int NVIDIA_MINOR_VERSION_GENERIC_SCHEDULER = 67; @@ -45,9 +64,9 @@ private static boolean isDriverVersionCompatible(OCLTargetDevice device) { private static OCLKernelScheduler getInstanceGPUScheduler(final OCLDeviceContext context) { OCLTargetDevice device = context.getDevice(); - if (device.getDeviceVendor().contains(AMD_VENDOR)) { + if (device.getDeviceVendor().contains(SUPPORTED_VENDORS.AMD.getName())) { return new OCLAMDScheduler(context); - } else if (device.getDeviceVendor().contains(NVIDIA)) { + } else if (device.getDeviceVendor().contains(SUPPORTED_VENDORS.NVIDIA.getName())) { if (isDriverVersionCompatible(device)) { return new OCLNVIDIAGPUScheduler(context); } else { @@ -60,15 +79,22 @@ private static OCLKernelScheduler getInstanceGPUScheduler(final OCLDeviceContext public static OCLKernelScheduler instanceScheduler(OCLDeviceType type, final OCLDeviceContext context) { switch (type) { - case CL_DEVICE_TYPE_GPU: + case CL_DEVICE_TYPE_GPU -> { return getInstanceGPUScheduler(context); - case CL_DEVICE_TYPE_ACCELERATOR: - return context.isPlatformFPGA() ? new OCLFPGAScheduler(context) : new OCLCPUScheduler(context); - case CL_DEVICE_TYPE_CPU: + } + case CL_DEVICE_TYPE_ACCELERATOR -> { + if (context.getDevice().getDeviceVendor().contains(SUPPORTED_VENDORS.CODEPLAY.getName())) { + return getInstanceGPUScheduler(context); + } else if (context.isPlatformFPGA()) { + return new OCLFPGAScheduler(context); + } else { + return new OCLCPUScheduler(context); + } + } + case CL_DEVICE_TYPE_CPU -> { return TornadoOptions.USE_BLOCK_SCHEDULER ? new OCLCPUScheduler(context) : getInstanceGPUScheduler(context); - default: - new TornadoLogger().fatal("No scheduler available for device: %s", context); - break; + } + default -> new TornadoLogger().fatal("No scheduler available for device: %s", context); } return null; }