Support Kotlin #324
Replies: 6 comments 4 replies
-
Hi @yijunwu. So far, we have tried R, Ruby, Javascript, and NodeJS, using the Truffle Framework (https://github.com/beehive-lab/TornadoVM/tree/master/examples/src/main/java/uk/ac/manchester/tornado/examples/polyglot). |
Beta Was this translation helpful? Give feedback.
-
I will close this issue. Please, feel free to open new issues for more questions, features, and bug reports. |
Beta Was this translation helpful? Give feedback.
-
Which all should be usable from Kotlin, right? It just compiles to Java Bytecode as well and that same way it can also interface with Java Annotations and APIs, as again it's all just Java Bytecode in the end. I'll definitely give it a try later if I get any example to run and see whether I can get that sample to run as well when ported to Kotlin. I suspect if there are any issues the Kotlin might be generated Bytecode that isn't allowed by TornadoVM or the standard lib, as it seems like not everything is supported. |
Beta Was this translation helpful? Give feedback.
-
As you point out, I am not sure if the Java BC generated by a Kotlin program are the same as in a Java program. In the case they are the same, I think it is possible to have a compatible version for TornadoVM, but we haven't tried just yet. If you want to try, please keep us posted in your findings. We are really curious. |
Beta Was this translation helpful? Give feedback.
-
It's largely very similar: @JvmStatic
fun compute(array: FloatArray) {
for (i: @Parallel Int in 0 until array.size) {
array[i] = array[i] + 100
}
} results in: @JvmStatic
public final void compute(@NotNull FloatArray array) {
Intrinsics.checkNotNullParameter(array, "array");
int i = 0;
for(int var3 = array.getSize(); i < var3; ++i) {
array.set(i, array.get(i) + (float)100);
}
} I'm not quite sure what's up with the annotation disappearing, but the java bytecode also look quite "funky" in the java version (apparently the annotation isn't on
Which in the decompiled version also just disappears: public static void compute(FloatArray array) {
for (int i = 0; i < array.getSize(); ++i) {
array.set(i, array.get(i) + 100.0f);
}
} Maybe there's a Kotlin bug to be found here, since this seems to be a rather esoteric usage of annotations... It doesn't get that far though:
because it doesn't seem to like that method... Full sample is here: https://gitlab.com/cromefire/tornado-kotlin P.S.: ROCm would probably a good idea for AMD cards, OCL just doesn't really seem to work at all as my card just idles at 5% in the benchmarks, it only seemed to spike once for a very short time. Probably not the way to get the most performance out of it. Maybe something is wrong with my setup, but then again, OCL just doesn't seem to be that great... (Even Khronos wants to replace it with Vulkan compute now...) |
Beta Was this translation helpful? Give feedback.
-
I moved the issue to a separate discussion page. Let's continue the conversation in this thread. |
Beta Was this translation helpful? Give feedback.
-
I would like Tornado to support Kotlin. The reason behind that is:
. Kotlin is expressive and concise, hence a good fit for data intensive / machine learning tasks, better fit than Java
. Kotlin is JVM language, might be relatively easy to support given Java is already supported
Beta Was this translation helpful? Give feedback.
All reactions