TornadoVM
TornadoVM copied to clipboard
TornadoVM performs more copies than needed for some applications
For example, for the mandelbrot application, there should be only a LAUNCH and STREAM_OUT at the bytecode level.
public static void mandelbrot(int size, short[] output) {
for (@Parallel int i = 0; i < size; i++) {
for (@Parallel int j = 0; j < size; j++) {
...
output[i * size + j] = r;
}
}
}
output = new short[size * size];
ts = new TaskSchedule("benchmark");
ts.task("t0", ComputeKernels::mandelbrot, size, output);
ts.streamOut(output);
However, we get the following sequence:
vm: COPY_IN [Object Hash Code=0x28975c28] [S@28975c28 on [Intel(R) OpenCL HD Graphics] -- Intel(R) UHD Graphics [0x9bc4], size=0, offset=0 [event list=-1]
vm: LAUNCH task benchmark.t0 - mandelbrot on [Intel(R) OpenCL HD Graphics] -- Intel(R) UHD Graphics [0x9bc4], size=0, offset=0 [event list=0]
vm: STREAM_OUT_BLOCKING [0x28975c28] [S@28975c28 on [Intel(R) OpenCL HD Graphics] -- Intel(R) UHD Graphics [0x9bc4], size=0, offset=0 [event list=1]
I believe the error is related to the data dependencies analyzer.
How To Reproduce
tornado --enableProfiler silent --printBytecodes uk.ac.manchester.tornado.benchmarks.BenchmarkRunner mandelbrot 50 512
Expected behaviour
VM: ALLOCATE
vm: LAUNCH task benchmark.t0 - mandelbrot on [Intel(R) OpenCL HD Graphics] -- Intel(R) UHD Graphics [0x9bc4], size=0, offset=0 [event list=0]
vm: STREAM_OUT_BLOCKING [0x28975c28] [S@28975c28 on [Intel(R) OpenCL HD Graphics] -- Intel(R) UHD Graphics [0x9bc4], size=0, offset=0 [event list=1]