beehive-lab / TornadoVM

TornadoVM: A practical and efficient heterogeneous programming framework for managed languages
https://www.tornadovm.org
Apache License 2.0
1.17k stars 110 forks source link

[fix] Some graal modules are not visible in runtime and driver modules and break Truffle interoperability #367

Closed stratika closed 4 months ago

stratika commented 5 months ago

Description

Problem: I tried to build the latest polyglot docker images with the latest TornadoVM version in develop and I got some problems related to graal modules that cannot be read from some tornado modules (tornado-runtime, tornado-drivers/opencl, tornado-drivers/ptx).

For instance:

tornado --printKernel --truffle python tornado-assembly/src/examples/polyglotTruffle/mxmWithTornadoVM.py

class uk.ac.manchester.tornado.runtime.TornadoCoreRuntime (in module tornado.runtime) cannot access class org.graalvm.collections.EconomicMap (in module org.graalvm.collections) because module tornado.runtime does not read module org.graalvm.collections
Traceback (most recent call last):
class uk.ac.manchester.tornado.runtime.TornadoCoreRuntime (in module tornado.runtime) cannot access class org.graalvm.collections.EconomicMap (in module org.graalvm.collections) because module tornado.runtime does not read module org.graalvm.collections
Traceback (most recent call last):
class uk.ac.manchester.tornado.runtime.TornadoCoreRuntime (in module tornado.runtime) cannot access class org.graalvm.collections.EconomicMap (in module org.graalvm.collections) because module tornado.runtime does not read module org.graalvm.collections

For the record, the SPIR-V backend is working. It did not throw this compatibility issue.

Solution: To address the problem this PR adds the modules as required in the relevant tornado modules.

Backend/s tested

Mark the backends affected by this PR.

OS tested

Mark the OS where this PR is tested.

Did you check on FPGAs?

If it is applicable, check your changes on FPGAs.

How to test the new patch?

To test the new patch, you must build GraalPython or TruffleRuby or GraalJS as described here. Once you have graalpython built, you can test it by using:

export GRAALPY_HOME=<your-directory>/graalpy-dev/graal/sdk/mxbuild/linux-amd64/GRAALVM_03DCD25EA1_JAVA21/graalvm-03dcd25ea1-java21-23.1.0-dev

make graal-jdk-21 BACKEND=opencl
tornado --printKernel --truffle python tornado-assembly/src/examples/polyglotTruffle/mxmWithTornadoVM.py

make graal-jdk-21 BACKEND=ptx
tornado --printKernel --truffle python tornado-assembly/src/examples/polyglotTruffle/mxmWithTornadoVM.py

make graal-jdk-21 BACKEND=spirv
tornado --printKernel --truffle python tornado-assembly/src/examples/polyglotTruffle/mxmWithTornadoVM.py

CLAassistant commented 5 months ago

CLA assistant check
All committers have signed the CLA.