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

[bug] Issue in TornadoVM-Ray-Tracer with SPIR-V in the JDK 22 branch #520

Open
stratika opened this issue Jul 31, 2024 · 0 comments
Open
Labels
bug Something isn't working jdk22

Comments

@stratika
Copy link
Collaborator

Describe the bug

I tried the experimental branch of TornadoVM and JDK 22 with TornadoVM-Ray-Tracer, and I noticed a problem for the SPIR-V backend.

How To Reproduce

I have built TornadoVM as follows:

git checkout feat/jdk22_2nd_iteration
rm -rf graalJars/
./bin/tornadovm-installer --jdk jdk-22 --backend spirv && source setvars.sh

There is a first issue when building the spirv backend:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project tornado-drivers-spirv: Compilation failure
[ERROR] /home/thanos/repositories/TornadoVM-stratika/tornado-drivers/spirv/src/main/java/uk/ac/manchester/tornado/drivers/spirv/graal/SPIRVStamp.java:[138,83] error: incompatible types: ResolvedJavaType cannot be converted to JavaKind

I did a small patch, to resolve the fromResolvedJavaType method, similar to the way it is in the other two backends, which you can apply, as follows:
JDK22_SPIRV.txt

git apply JDK22_SPIRV.txt
make BACKEND=spirv
tornado --version

returns

version=1.0.7-dev
branch=feat/jdk22_2nd_iteration
commit=dec5a87

Backends installed: 
	 - spirv

I checked out at the TornadoVM-Ray-Tracer branch and set the variables to use the JDK 22 as JAVA_HOME:

git checkout integration/jdk22
mvn clean install

Then I ran the ray tracer with the regression parameter (in console), and got the output as follows:

tornadovm-ray-tracer regression
-----------------------------------------
Running TornadoVM Ray Tracer benchmark mode...
WARNING: Using incubator modules: jdk.incubator.vector
-----------------------------------------
Building world...
-> Loading Skybox Image 'Sky.jpg'...
-> Adding object to the scene...
-> Allocating object representation buffers...
Exception in thread "main" uk.ac.manchester.tornado.api.exceptions.TornadoInternalError: unimplemented: stamp is compat: spirv: OP_TYPE_VECTOR4_FLOAT_32 + a# uk.ac.manchester.tornado.api.types.vectors.Float4
	at [email protected]/uk.ac.manchester.tornado.api.exceptions.TornadoInternalError.unimplemented(TornadoInternalError.java:37)
	at [email protected]/uk.ac.manchester.tornado.drivers.spirv.graal.SPIRVStamp.isCompatible(SPIRVStamp.java:143)
	at jdk.graal.compiler/jdk.graal.compiler.phases.common.FixReadsPhase$FixReadsClosure.processNode(FixReadsPhase.java:161)
	at jdk.graal.compiler/jdk.graal.compiler.phases.graph.ScheduledNodeIterator.processNodes(ScheduledNodeIterator.java:67)
	at jdk.graal.compiler/jdk.graal.compiler.phases.common.FixReadsPhase.run(FixReadsPhase.java:689)
	at jdk.graal.compiler/jdk.graal.compiler.phases.common.FixReadsPhase.run(FixReadsPhase.java:106)
	at jdk.graal.compiler/jdk.graal.compiler.phases.BasePhase.apply(BasePhase.java:435)
	at jdk.graal.compiler/jdk.graal.compiler.phases.BasePhase.apply(BasePhase.java:323)
	at jdk.graal.compiler/jdk.graal.compiler.phases.PhaseSuite.run(PhaseSuite.java:390)
	at jdk.graal.compiler/jdk.graal.compiler.phases.BasePhase.apply(BasePhase.java:435)
	at jdk.graal.compiler/jdk.graal.compiler.phases.BasePhase.apply(BasePhase.java:323)
	at [email protected]/uk.ac.manchester.tornado.drivers.spirv.graal.compiler.SPIRVCompiler.emitFrontEnd(SPIRVCompiler.java:172)
	at [email protected]/uk.ac.manchester.tornado.drivers.spirv.graal.compiler.SPIRVCompiler.compile(SPIRVCompiler.java:121)
	at [email protected]/uk.ac.manchester.tornado.drivers.spirv.graal.compiler.SPIRVCompiler$SPIRVCompilationRequest.execute(SPIRVCompiler.java:508)
	at [email protected]/uk.ac.manchester.tornado.drivers.spirv.graal.compiler.SPIRVCompiler.compileSketchForDevice(SPIRVCompiler.java:364)
	at [email protected]/uk.ac.manchester.tornado.drivers.spirv.runtime.SPIRVTornadoDevice.compileTask(SPIRVTornadoDevice.java:182)
	at [email protected]/uk.ac.manchester.tornado.drivers.spirv.runtime.SPIRVTornadoDevice.installCode(SPIRVTornadoDevice.java:135)
	at [email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.compileTaskFromBytecodeToBinary(TornadoVMInterpreter.java:662)
	at [email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.execute(TornadoVMInterpreter.java:332)
	at [email protected]/uk.ac.manchester.tornado.runtime.interpreter.TornadoVMInterpreter.execute(TornadoVMInterpreter.java:903)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:782)
	at [email protected]/uk.ac.manchester.tornado.runtime.TornadoVM.executeInterpreterSingleThreaded(TornadoVM.java:125)
	at [email protected]/uk.ac.manchester.tornado.runtime.TornadoVM.execute(TornadoVM.java:112)
	at [email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.scheduleInner(TornadoTaskGraph.java:906)
	at [email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.execute(TornadoTaskGraph.java:1430)
	at [email protected]/uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph.execute(TornadoTaskGraph.java:1442)
	at [email protected]/uk.ac.manchester.tornado.api.TaskGraph.execute(TaskGraph.java:758)
	at [email protected]/uk.ac.manchester.tornado.api.ImmutableTaskGraph.execute(ImmutableTaskGraph.java:49)
	at [email protected]/uk.ac.manchester.tornado.api.TornadoExecutionPlan$TornadoExecutor.lambda$execute$0(TornadoExecutionPlan.java:410)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
	at [email protected]/uk.ac.manchester.tornado.api.TornadoExecutionPlan$TornadoExecutor.execute(TornadoExecutionPlan.java:410)
	at [email protected]/uk.ac.manchester.tornado.api.TornadoExecutionPlan.execute(TornadoExecutionPlan.java:111)
	at com.vinhderful.raytracer.Benchmark.main(Benchmark.java:112)

Expected behavior

The expected behavior is as is in the develop branch with spirv:

tornadovm-ray-tracer regression
-----------------------------------------
Running TornadoVM Ray Tracer benchmark mode...
WARNING: Using incubator modules: jdk.incubator.vector
-----------------------------------------
Building world...
-> Loading Skybox Image 'Sky.jpg'...
-> Adding object to the scene...
-> Allocating object representation buffers...
-----------------------------------------
Getting Tornado Devices...
0: (SPIR-V) Intel(R) Graphics [0x46a6]
1: (SPIR-V) Intel(R) Graphics [0x46a6]
2: (OpenCL) NVIDIA RTX A2000 8GB Laptop GPU
3: (OpenCL) Intel(R) Graphics [0x46a6]
-----------------------------------------
Running [JAVA PARALLEL STREAMS]
Duration: 40.611194 ms
-----------------------------------------
-----------------------------------------
Running with TornadoVM for device: SPIRV OCL - Intel(R) Graphics [0x46a6]
Duration: 2.335913 ms
-----------------------------------------
Performance increase vs Java Streams: 17.385576431998963x
-----------------------------------------
-----------------------------------------
Running with TornadoVM for device: SPIRV LevelZero - Intel(R) Graphics [0x46a6]
Duration: 2.241852 ms
-----------------------------------------
Performance increase vs Java Streams: 18.115020081611092x
-----------------------------------------
-----------------------------------------
Running with TornadoVM for device:  [NVIDIA CUDA] -- NVIDIA RTX A2000 8GB Laptop GPU
Duration: 1.049211 ms
-----------------------------------------
Performance increase vs Java Streams: 38.70641272346554x
-----------------------------------------
-----------------------------------------
Running with TornadoVM for device:  [Intel(R) OpenCL HD Graphics] -- Intel(R) Graphics [0x46a6]
Duration: 2.374471 ms
-----------------------------------------
Performance increase vs Java Streams: 17.10325963130314x
-----------------------------------------

Computing system setup (please complete the following information):

  • OS: Ubuntu 23.10
  • BACKEND: spirv
  • TornadoVM commit id: dec5a87 from branch feat/jdk22_2nd_iteration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working jdk22
Projects
None yet
Development

No branches or pull requests

1 participant