beehive-lab / TornadoVM

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

Extension of the prebuilt API to be able to load prebuilt kernels stored in JAR files #483

Closed jjfumero closed 2 months ago

jjfumero commented 3 months ago

Description

Extension of the prebuilt API to be able to load prebuilt kernels stored in JAR files.

Example:

 TaskGraph taskGraph = new TaskGraph("reftg")
      .transferToDevice(DataTransferMode.EVERY_EXECUTION, problemDimensions, problemParameters, doubleTimes, doubleValues, doubleWeights,  doubleFreqs, tsIdPerFreq)
    .prebuiltTask("t1",             // task name
        "sampleKernel",         // kernel nme
                  MyJavaClass.class,   // class accessible from the JAR file that contains the resource 
        "myKernel.ptx",          // name of the kernel file
        new Object[] { problemDimensions, problemParameters, doubleTimes, doubleValues, doubleWeights,  doubleFreqs, tsIdPerFreq, doubleAmplitudes, doubleDebug }, //
        new Access[] { Access.READ_ONLY, Access.READ_ONLY, Access.READ_ONLY,Access.READ_ONLY,Access.READ_ONLY, Access.READ_ONLY, Access.READ_ONLY, Access.WRITE_ONLY, Access.WRITE_ONLY }, //
        preferredDevice, //
        new int[] { nThreads })
         .transferToHost(DataTransferMode.EVERY_EXECUTION, doubleAmplitudes, doubleDebug);

This API access is required by GAIA for the project AERO. We may also simplify this API in future versions, since the main purpose was for debugging, not for running production code.

Problem description

If the patch provides a fix for a bug, please describe what was the issue and how to reproduce the issue.

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?

This change has been tested in the GAIA code base.

make
make tests
jjfumero commented 3 months ago

I am going to convert this to a draft PR because this extension might go well after PR #487

jjfumero commented 2 months ago

I am closing this PR. Instead, the new version is available in #505