TornadoVM icon indicating copy to clipboard operation
TornadoVM copied to clipboard

exceptions when using @Parallel with Double3

Open gaoyang-li opened this issue 4 months ago • 3 comments

Describe the bug

Exception in thread "main" uk.ac.manchester.tornado.api.exceptions.TornadoInternalError: org.graalvm.compiler.debug.GraalError: should not reach here: node is not LIRLowerable: 16|VectorStoreElementProxy at [email protected]/uk.ac.manchester.tornado.drivers.opencl.graal.compiler.OCLNodeLIRBuilder.doBlock(OCLNodeLIRBuilder.java:238) at [email protected]/uk.ac.manchester.tornado.drivers.opencl.graal.compiler.OCLLIRGenerationPhase.emitBlock(OCLLIRGenerationPhase.java:51) at [email protected]/uk.ac.manchester.tornado.drivers.opencl.graal.compiler.OCLLIRGenerationPhase.run(OCLLIRGenerationPhase.java:65) at [email protected]/uk.ac.manchester.tornado.drivers.opencl.graal.compiler.OCLLIRGenerationPhase.run(OCLLIRGenerationPhase.java:41) at jdk.internal.vm.compiler/org.graalvm.compiler.lir.phases.LIRPhase.apply(LIRPhase.java:121) at jdk.internal.vm.compiler/org.graalvm.compiler.lir.phases.LIRPhase.apply(LIRPhase.java:110) at [email protected]/uk.ac.manchester.tornado.drivers.opencl.graal.compiler.OCLCompiler.emitLIR0(OCLCompiler.java:261) at [email protected]/uk.ac.manchester.tornado.drivers.opencl.graal.compiler.OCLCompiler.emitLIR(OCLCompiler.java:216) at [email protected]/uk.ac.manchester.tornado.drivers.opencl.graal.compiler.OCLCompiler.emitBackEnd(OCLCompiler.java:201) at [email protected]/uk.ac.manchester.tornado.drivers.opencl.graal.compiler.OCLCompiler.compile(OCLCompiler.java:138) at [email protected]/uk.ac.manchester.tornado.drivers.opencl.graal.compiler.OCLCompiler$Request.execute(OCLCompiler.java:509) at [email protected]/uk.ac.manchester.tornado.drivers.opencl.graal.compiler.OCLCompiler.compileSketchForDevice(OCLCompiler.java:386) at [email protected]/uk.ac.manchester.tornado.drivers.opencl.runtime.OCLTornadoDevice.compileTask(OCLTornadoDevice.java:261) at [email protected]/uk.ac.manchester.tornado.drivers.opencl.runtime.OCLTornadoDevice.compileJavaToAccelerator(OCLTornadoDevice.java:335) at [email protected]/uk.ac.manchester.tornado.drivers.opencl.runtime.OCLTornadoDevice.installCode(OCLTornadoDevice.java:462)

How To Reproduce

public static void parallel1(Double3 d, int x){
    for (@Parallel int i = 0; i < x; i++){
        d.setX(1.1);
    }
}
public static void parallel2(Double3 d, int x){
    for (@Parallel int i = 0; i < x; i++){
        d.setX(d.getX() + 1.1);
    }
}

public static void main (String[] args){
    Double3 d = new Double3();
    Double2 dd = new Double2();
    VectorDouble ddd = new VectorDouble(1);
    d.setX(1.1);
    dd.setX(1.1);
    ddd.set(0, 1.1);
    int x = 10;

    TaskGraph taskGraph1 = new TaskGraph("s1")
            .transferToDevice(DataTransferMode.EVERY_EXECUTION, d, x)
            .task("t1", Double3Test::parallel1, d, x)
            .transferToHost(DataTransferMode.EVERY_EXECUTION, d);
    ImmutableTaskGraph immutableTaskGraph1 = taskGraph1.snapshot();
    TornadoExecutionPlan executor1 = new TornadoExecutionPlan(immutableTaskGraph1);
    executor1.execute();

    TaskGraph taskGraph2 = new TaskGraph("s2")
            .transferToDevice(DataTransferMode.EVERY_EXECUTION, d, x)
            .task("t2", Double3Test::parallel2, d, x)
            .transferToHost(DataTransferMode.EVERY_EXECUTION, d);
    ImmutableTaskGraph immutableTaskGraph2 = taskGraph2.snapshot();
    TornadoExecutionPlan executor2 = new TornadoExecutionPlan(immutableTaskGraph2);
    executor2.execute();
}

Expected behavior

Modify a value of a 'Double3' variable inside the parallelised loop.

Computing system setup (please complete the following information):

  • OS: Ubuntu 22.04.3 LTS
  • OpenCL and Driver versions: NVIDIA CUDA: OpenCL 3.0 CUDA 12.2.148 Intel OpenCL: OpenCL 3.0
  • If applicable, PTX and CUDA Driver versions: CUDA Compilation Tools Version: 12.2 CUDA Release Version: V12.2.140
  • If applicable, Level Zero & SPIR-V Versions
  • TornadoVM commit id: 188e3a42a24ad775b2d6fcc83636bc7548a1142f

gaoyang-li avatar Mar 04 '24 19:03 gaoyang-li