Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ComputeAorta/OCK thread scheduler for the OpenCL backend #532

Merged
merged 3 commits into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 {
Expand All @@ -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;
}
Expand Down