[fix] TornadoVM backend initialization with multiple backends allowed
@@ -82,6 +82,7 @@ import jdk.vm.ci.meta.Local;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.meta.ResolvedJavaType;
import jdk.vm.ci.meta.Value;
+import uk.ac.manchester.tornado.api.common.TornadoDevice;
import uk.ac.manchester.tornado.api.exceptions.TornadoRuntimeException;
import uk.ac.manchester.tornado.api.type.annotations.Vector;
import uk.ac.manchester.tornado.drivers.opencl.*;
@@ -256,7 +257,7 @@ public class OCLBackend extends TornadoBackend<OCLProviders> implements FrameMap
String deviceDriver = deviceFullName.split("=")[1];
int driverIndex = Integer.parseInt(deviceDriver.split(":")[0]);
int deviceIndex = Integer.parseInt(deviceDriver.split(":")[1]);
- OCLTornadoDevice device = (OCLTornadoDevice) TornadoCoreRuntime.getTornadoRuntime().getDriver(driverIndex).getDevice(deviceIndex);
+ TornadoDevice device = getTornadoRuntime().getDriver(driverIndex).getDevice(deviceIndex);
String platformName = device.getPlatformName();
if (!isDeviceAnFPGAAccelerator() || !isFPGA(platformName)) {
return false;
@@ -590,7 +591,8 @@ public class OCLBackend extends TornadoBackend<OCLProviders> implements FrameMap
return new OCLFrameMapBuilder(newFrameMap(registerConfigNonNull), getCodeCache(), registerConfig);
}
- public LIRGenerationResult newLIRGenerationResult(CompilationIdentifier identifier, LIR lir, FrameMapBuilder frameMapBuilder, RegisterAllocationConfig registerAllocationConfig, StructuredGraph graph, Object stub) {
+ public LIRGenerationResult newLIRGenerationResult(CompilationIdentifier identifier, LIR lir, FrameMapBuilder frameMapBuilder, RegisterAllocationConfig registerAllocationConfig,
+ StructuredGraph graph, Object stub) {
return new OCLLIRGenerationResult(identifier, lir, frameMapBuilder, registerAllocationConfig, new CallingConvention(0, null, (AllocatableValue[]) null));
}
