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

Not able to work with interfaces #287

Open
MaardinK522 opened this issue Nov 29, 2023 · 4 comments
Open

Not able to work with interfaces #287

MaardinK522 opened this issue Nov 29, 2023 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@MaardinK522
Copy link

MaardinK522 commented Nov 29, 2023

Throws error with interfaces

I was trying to work with interfaces and Matrix mapping using lambda functions. I am unable to understand the logic here. I needed help to achieve matrix mapping using the interface in TornadoVM.

After executing the program

https://github.com/MaardinK522/tornadoVM.git
Try running this project on IntelliJ IDEA.
My code is pretty much self explanatory.

Not mapping matrix with interface functions.

I am passing an anonymous function which was suppose to be execute on Parallel threads for applying activation to each value of matrix data. Unlucky, I got stuck with a small confusion of interfaces with Null data types from the error feedback.
WARNING: Code Bailout to Java sequential. Use --debug to see the reason Exception in thread "main" uk.ac.manchester.tornado.api.exceptions.TornadoBailoutRuntimeException: Unable to build sketch for method: matrixToActivationFunctionMapper(Cannot invoke "jdk.vm.ci.meta.ResolvedJavaType.getAnnotation(java.lang.Class)" because the return value of "org.graalvm.compiler.core.common.type.ObjectStamp.type()" is null) at tornado.runtime@0.16-dev/uk.ac.manchester.tornado.runtime.sketcher.TornadoSketcher.buildSketch(TornadoSketcher.java:190) at tornado.runtime@0.16-dev/uk.ac.manchester.tornado.runtime.sketcher.TornadoSketcher$TornadoSketcherCallable.call(TornadoSketcher.java:263) at tornado.runtime@0.16-dev/uk.ac.manchester.tornado.runtime.sketcher.TornadoSketcher$TornadoSketcherCallable.call(TornadoSketcher.java:253) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.lang.Thread.run(Thread.java:1583)
This is the error which I am encountering right now.
Hope your team will have some suggestion for me.

@jjfumero
Copy link
Member

Hi @MaardinK522 , thank you for the report.

My take is that you are running this example, let me know otherwise:
https://github.com/MaardinK522/tornadoVM/blob/master/src/main/java/com/example/Main.java#L53-L59

The first thing I see is that you are using a custom data type to pass the parameters (Matrix). This is not supported in TornadoVM. To do so, TornadoVM offers a collection of data types for vectors, matrices and images.

The reason is that the TornadoVM JIT compiler knows the layout and the operations to apply for each of these data types, and the error you are getting is related to the TornadoVM JIT compilation process.

See here all data types: https://github.com/beehive-lab/TornadoVM/tree/master/tornado-api/src/main/java/uk/ac/manchester/tornado/api/types

Examples with matrices : https://github.com/beehive-lab/TornadoVM/blob/master/tornado-unittests/src/main/java/uk/ac/manchester/tornado/unittests/matrices/TestMatrixTypes.java

@jjfumero jjfumero self-assigned this Nov 29, 2023
@jjfumero jjfumero added the question Further information is requested label Nov 29, 2023
@MaardinK522
Copy link
Author

I was really wondering if TornadoVM team could had found a way to convert custom classes into Supportable TornadoVM JIT classes. So, programmer spend time convert his/her classes into Supportable data types like we annotate classes while working with Databases.

@MaardinK522
Copy link
Author

Sir, thank you very much for bringing something I wanted in my life. And I will really try my best to join TornadoVM team.

@jjfumero
Copy link
Member

Thank you for your feedback. So bear in mind that TornadoVM now uses Panama segments for all these data types. Internally, TornadoVM has a custom segment layout to be able to compile to OpenL/SPIR-V and PTX for many different types of applications.

Having said this, I will bring this topic to discuss internally with the TornadoVM team, but, for the time being, I would use the "stock" data types that TornadoVM provides.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants