NewsLab
Oct 27 23:08 UTC

TornadoVM 7 Enables GPU-Native Workloads from Java Applications (infoq.com)

95 points|by pjmlp||23 comments|Read full story on infoq.com

Comments (23)

23 shown
  1. 1. mikepapadim||context
    https://github.com/beehive-lab/TornadoVM this is main repo.

    You can use it with any JDK21+ and Nvidia or Apple hardware and their Nvidia libs or MLX libs.

  2. 2. Akseleu_omirbay||context
    And what about TPU support? Is it compatible with Google TPUs or strictly limited to gpu backends like CUDA and Metal?
  3. 3. mikepapadim||context
    no TPU support yet, just NVIDIA, Apple and any other HW thats supports OpenCL
  4. 4. the_arun||context
    Does this mean we can use Java to build AI infrastructure?
  5. 5. vlowrian||context
    Or an abstract AI infrastructure factory?
  6. 6. mikepapadim||context
    https://github.com/beehive-lab/jitllm there is already an vllm-like inference engine that uses tornadovm as the GPU backend all written in java
  7. 7. kitd||context
    I'll be disappointed if this isn't named AbstractAiInfrastructureFactory
  8. 8. pjmlp||context
    These kind of complaints get tiresome, here for some Objective-C fun,

    https://github.com/Quotation/LongestCocoa

  9. 9. hoppp||context
    AbstractAiInfrastructureComponentInitializationAndConfigurationFactory
  10. 10. keeda||context
    That’s probably the next thing after Software Factories.
  11. 11. mike_hearn||context
    Yes (or any JVM lang). There is also this:

    https://qxotic.ai/

    ... which is a single JAR that does SIMD accelerated inferencing of local models, dependency free. Everything is written in Java from the tokenizer up. It can also use Metal on macOS. Small models can be surprisingly powerful these days and all you need is a fast CPU. It works not only for LLMs but also image models, video models and speech.

    Remarkably, it is significantly faster than llama.cpp on some tasks like prefill (decode is memory bandwidth constrained so language hardly makes a difference). At least as long as you run on GraalVM (JVM or native image, both work). So you can actually beat C++ performance for AI in Java.

    It's impressive stuff.

  12. 12. vips7L||context
    Why GraalVM specifically? Is it something special with the Graal JIT?
  13. 13. mike_hearn||context
    It optimizes more aggressively, yes.
  14. 14. amir734jj||context
    Basically JAX for Java instead of Python
  15. 15. mikepapadim||context
    Many components for a jax for java are already tested in https://github.com/beehive-lab/jitllm
  16. 16. mathisfun123||context
    "your scientists were so preoccupied with whether they could they didn't stop to think if they should"
  17. 17. zmmmmm||context
    Seems like a nice win even if it just does the example they have:

        void matmul(Matrix2DFloat A, Matrix2DFloat B, Matrix2DFloat C, int size) {
          for (@Parallel int i=0; i<size; i++) {
            for (@Parallel int j=0; j<size; j++) {
              float sum = 0f;
              for (int k=0; k<size; k++)
                sum += A.get(i,k)*B.get(k,j);
              C.set(i, j, sum);
            }
          }
        }
    
    But the elephant in the room is the Vector API. Is that going to end up like logging - a standardised API nobody uses because it came 10 years late to the party and isn't as good as what was already established?

    And why confuse everybody by calling it a VM when it ships as a JAR file that runs in an existing VM?

  18. 18. russli1993||context
    what about tiling? seems better to call into existing kernels, fused megakernels than rewrite kernel in java.
  19. 19. zmmmmm||context
    i might be overly optimistic, but I'm assuming it'll do the tiling by itself with the above. As long as there's not an algorithmic reason to do it a specific way, in theory you could just optimise it for the target hardware.
  20. 20. mikepapadim||context
    For now it supports directly cuTile through what they call TileContext API. Is a 1-1 mapping of the cuTile C++ implementation.
  21. 21. mikepapadim||context
    You can do both. It supports nvidia's cuTile programming model through Tilecontext API or you can write megakernels in Java and compile then to CUDA or even add native libraries in the mix like cudnn. JITllm is a good example how all these can work together
  22. 22. pjmlp||context
    I actually use the logging API, it is good enough, and maybe I am old enough not to like to cowboy install dependencies if I can avoid it.
  23. 23. hoppp||context
    How is ML using java?

    My impression was that people mainly use python.

    Pros and cons?