[code-reflection] RFR: Example use of code reflection in translating Java to SPIR-V

Juan Fumero juan.fumero at paravox.ai
Wed Mar 13 12:08:03 UTC 2024


Hi Steve,

    that's great. I haven't looked at the whole PR just yet.

Just one minor thing to consider when using the SPIR-V Toolkit. You 
might want to use a new ID to identify the code gen, since the ID 29 is 
taken. You can see all definitions here:

https://github.com/KhronosGroup/SPIRV-Headers/blob/main/include/spirv/spir-v.xml#L82C25-L82C48

So something like this will do the job, as the ID 42 is available:

this.module= newSPIRVModule(newSPIRVHeader(1, 2, 42, 0, 0));

Kind regards

Juan


On 12/03/2024 23:57, Steve Dohrmann wrote:
> Example code showing use of code reflection in translation from Java to SPIR-V intermediate language.  For more information on SPIR-V see [https://www.khronos.org/spir](https://www.khronos.org/spir).
>
> Translates from a Java CoreOps.FuncOp object to a SpirvOps.FuncOp object and then to an entry point in a SPIR-V binary module.  One test is included that demonstrates use and renders the Java model, SPIR-V model, and disassembled binary representations of an example Java method.
>
> A subsequent pull-request will provide additional test code, including the ability to test SPIR-V binaries on GPU hardware.
>
> Dependencies:
>
> This code depends on a Java SPIR-V builder API (https://github.com/beehive-lab/beehive-spirv-toolkit).  The toolkit can be installed locally with:
>
> git clonehttps://github.com/beehive-lab/beehive-spirv-toolkit  
> cd beehive-spirv-toolkit
> mvn clean install
>
> -------------
>
> Commit messages:
>   - fix more whitespace issues
>   - fix whitespace issues
>   - fix README
>   - fix pom header
>   - spirv-example initial commit
>
> Changes:https://git.openjdk.org/babylon/pull/38/files
>    Webrev:https://webrevs.openjdk.org/?repo=babylon&pr=38&range=00
>    Stats: 2448 lines in 10 files changed: 2448 ins; 0 del; 0 mod
>    Patch:https://git.openjdk.org/babylon/pull/38.diff
>    Fetch: git fetchhttps://git.openjdk.org/babylon.git  pull/38/head:pull/38
>
> PR:https://git.openjdk.org/babylon/pull/38
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/babylon-dev/attachments/20240313/013257d7/attachment-0001.htm>


More information about the babylon-dev mailing list