Open
Description
Description
Running TornadoVM powered applications on a PC with Turkish locale yields to following error:
Unable to compile task graph.double - computeDouble
The internal error is: [Error during the Task Compilation]: Unsupported type: ınt
Stacktrace: [
[email protected]/uk.ac.manchester.tornado.drivers.opencl.runtime.OCLTornadoDevice.compileTask(OCLTornadoDevice.java:306)
[email protected]/uk.ac.manchester.tornado.drivers.opencl.runtime.OCLTornadoDevice.compileJavaToAccelerator(OCLTornadoDevice.java:342)
[email protected]/uk.ac.manchester.tornado.drivers.opencl.runtime.OCLTornadoDevice.installCode(OCLTornadoDevice.java:469)
[email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.compileTaskFromBytecodeToBinary(TornadoVMInterpreter.java:670)
[email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.execute(TornadoVMInterpreter.java:333)
[email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.execute(TornadoVMInterpreter.java:909)
java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
[email protected]/uk.ac.manchester.tornado.runtime.TornadoVM.executeInterpreterSingleThreaded(TornadoVM.java:127)
[email protected]/uk.ac.manchester.tornado.runtime.TornadoVM.execute(TornadoVM.java:114)
[email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.scheduleInner(TornadoTaskGraph.java:892)
[email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.execute(TornadoTaskGraph.java:1470)
[email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.execute(TornadoTaskGraph.java:1499)
[email protected]/uk.ac.manchester.tornado.api.TaskGraph.execute(TaskGraph.java:759)
[email protected]/uk.ac.manchester.tornado.api.ImmutableTaskGraph.execute(ImmutableTaskGraph.java:50)
[email protected]/uk.ac.manchester.tornado.api.TornadoExecutor.lambda$execute$0(TornadoExecutor.java:47)
java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
[email protected]/uk.ac.manchester.tornado.api.TornadoExecutor.execute(TornadoExecutor.java:47)
[email protected]/uk.ac.manchester.tornado.api.TornadoExecutionPlan.execute(TornadoExecutionPlan.java:163)
com.corp.compute.TornadoCompute.buildAndRun(TornadoCompute.java:33)
com.corp.Main.main(Main.java:30)
]
To overcome the issue following JVM parameters should be added as a workaround:
-Duser.country=US -Duser.language=en
Dec 22, 2024 6:24:03 PM uk.ac.manchester.tornado.runtime.common.TornadoLogger debug
INFO: OpenCL compilation status = CL_BUILD_SUCCESS
TornadoVM test reports similar errors. To eliminate the errors, test should be run as follows:
tornado-test -V --jvm="-Duser.country=US -Duser.language=en"
How To Reproduce
Ensure system locale is set as tr-TR
and use OpenCL backend:
% defaults read .GlobalPreferences AppleLanguages
(
"tr-TR"
)
Use following computation execution:
package com.corp.compute;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.ac.manchester.tornado.api.TaskGraph;
import uk.ac.manchester.tornado.api.TornadoExecutionPlan;
import uk.ac.manchester.tornado.api.TornadoExecutionResult;
import uk.ac.manchester.tornado.api.annotations.Parallel;
import uk.ac.manchester.tornado.api.enums.DataTransferMode;
import uk.ac.manchester.tornado.api.exceptions.TornadoExecutionPlanException;
import uk.ac.manchester.tornado.api.math.TornadoMath;
import uk.ac.manchester.tornado.api.types.arrays.FloatArray;
public class TornadoCompute {
private static final Logger logger = LoggerFactory.getLogger(TornadoCompute.class.getName());
private TornadoCompute() {
throw new IllegalStateException("%s is a utility class and cannot be instantiated!".formatted(this.getClass().getName()));
}
public static void buildAndRun(FloatArray array) {
//@formatter:off
TaskGraph taskGraph = new TaskGraph("graph")
.transferToDevice(DataTransferMode.EVERY_EXECUTION, array)
.task("double", TornadoCompute::computeDouble, array)
.task("sqrt", TornadoCompute::computeSqrt, array)
.transferToHost(DataTransferMode.EVERY_EXECUTION, array);
//@formatter:on
try (TornadoExecutionPlan tornadoExecutionPlan = new TornadoExecutionPlan(taskGraph.snapshot())) {
logger.info("Pre-execution result: {}", array.get(1));
TornadoExecutionResult result = tornadoExecutionPlan.execute();
logger.info("Execution time: {}", result.getProfilerResult().getTotalTime());
logger.info("Post-execution result: {}", array.get(1));
} catch (TornadoExecutionPlanException e) {
logger.error("Tornado execution error:", e);
}
}
private static void computeDouble(FloatArray array) {
for (@Parallel int i = 0; i < array.getSize(); i++) {
float value = array.get(i);
array.set(i, value * 2);
}
}
private static void computeSqrt(FloatArray array) {
for (@Parallel int i = 0; i < array.getSize(); i++) {
float value = array.get(i);
array.set(i, TornadoMath.sqrt(value));
}
}
}
Invoke TornadoVM computation:
package com.corp;
import java.util.Random;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.corp.compute.TornadoCompute;
import uk.ac.manchester.tornado.api.types.arrays.FloatArray;
public class Main {
private static final Logger logger = LoggerFactory.getLogger(Main.class.getName());
public static void main(String[] args) {
Random rand = new Random();
int noOfElements = 10000;
FloatArray floatArray = new FloatArray(noOfElements);
for (int i = 0; i < noOfElements; i++) {
float randFloat = rand.nextFloat(noOfElements);
floatArray.set(i, randFloat);
}
logger.info("Starting computation");
TornadoCompute.buildAndRun(floatArray);
logger.info("Finished computation");
}
}
Expected behavior
Execution should result in success.
Computing system setup (please complete the following information):
- OS: MacOS 15.2
- OpenCL and Driver versions
Tornado device=0:1 OPENCL -- [Apple] -- AMD Radeon Pro 5500M Compute Engine Global Memory Size: 4,0 GB Local Memory Size: 64,0 KB Workgroup Dimensions: 3 Total Number of Block Threads: [256] Max WorkGroup Configuration: [256, 256, 256] Device OpenCL C version: OpenCL C 1.2
Additional context
From stack trace it seems following invocation turns out to be letter ı
in Turkish for Integer type name instead of i
:
Metadata
Assignees
Labels
Type
Projects
Status
No status