<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
Hi David,<br>
<div><br>
<blockquote type="cite">
<div>On Sep 6, 2023, at 12:15 PM, David Alayachew <davidalayachew@gmail.com> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div dir="ltr">
<div class="gmail_default" style="font-family:monospace">Hello Paul,</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">Thanks for posting this and the attached videos! I'm very excited for the possibilities that this project Babylon will bring about, but I do have a handful of initial questions.</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">1 - Can you help differentiate the goals between Babylon and Panama's FFI/M? I don't understand either project very well, and (from my ignorant perspective) there seems to be a lot of overlap. What separates
 them?</div>
</div>
</div>
</blockquote>
<div><br>
</div>
They are complementary, arguably the two together are greater than the sum of the parts. Panama focuses on interconnecting to native (or foreign) code, where as Babylon will focus on reaching out to foreign programming models. The GPU programming model will
 bring the two together, as presented by Gary at JVMLS.</div>
<div><br>
</div>
<div><br>
<blockquote type="cite">
<div>
<div dir="ltr">
<div class="gmail_default" style="font-family:monospace">2 - I read a little about Project Sumatra, and other attempts for Java to interact with the GPU. While this project has a bigger end goal, will it be Java's current, main attempt to tackle GPU in the
 programming language?</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>It will be an attempt that 1) will ensure code reflection is fit for purpose; and 2) inform how to design a good Java library that supports GPU programing. It’s too early to say where that will lead, but I do hope interested members of the OpenJDK community
 will collaborate on the design.</div>
<div><br>
</div>
<br>
<blockquote type="cite">
<div>
<div dir="ltr">
<div class="gmail_default" style="font-family:monospace">    2.1 - If yes, what lessons have we learned from the past projects? Clearly, this is coming from a wildly different direction, but hearing about some motivations might help us understand the WHY along
 with the WHAT.</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Others are more qualified to talk on the specifics of Project Sumatra than I, but I can give you my take. Sumatra was very ambitious and modified the JVM to support the compilation of bytecode to GPU code (as kernels), including support for garbage collection.
 That’s a lot of complexity esp. required to preserve Java program meaning, and modify the specification of Java program meaning for this case. We can learn from this and simplify the problem by providing a key building block, code reflection, such that an
 ordinary Java program (a library) can transform Java programs to GPU programs without having to preserve Java program meaning. Thereby the Java library is free to evolve independently of the Java platform.</div>
<div><br>
</div>
<br>
<blockquote type="cite">
<div>
<div dir="ltr">
<div class="gmail_default" style="font-family:monospace">3 - Just flipping through the slides and having watched the videos, that is an intimidating amount of complexity. It intimidated me at least. Who is the target audience for this project, and what steps
 are needed to get them equipped to use these tools effectively? To give an example of the second question, String templates are clearly a needed and valuable feature, but it has become clear that the use cases and intended semantics for it aren't exactly clear
 to all Java developers. After extended discussion on the mailing lists and various social media threads, there's talk about a user guide for String templates being created. A similar thing was done for Text Blocks, if I'm not mistaken. I guess a better way
 of restating question 2 is, do you foresee difficulties in getting developers to see the use cases and intended semantics of the code reflection you spoke of? And if so, what steps do you plan to take to "nip it in the bud", so to speak?</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>I do foresee difficulties getting the concepts across, esp. the concept of Java code that is not directly executable and represents some intent. Examples, prior art, and positioning documents will help but they will take time to produce. It’s early days
 so we have time and will adjust as we learn. </div>
<div><br>
</div>
<div>The target audience is library developers, enabling them to design novel APIs in combination with natural language constructs, which is a new form of API design. However, we should strive to design code reflection so it is reasonably accessible to a broad
 set of Java developers i.e., it has to have the “feel" of Java. My hope is we see some surprising and creative uses.</div>
<div><br>
</div>
<br>
<blockquote type="cite">
<div>
<div dir="ltr">
<div class="gmail_default" style="font-family:monospace">4 - Why Babylon?</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Naming is hard!</div>
<div><br>
</div>
<div>The ancient city was a melting pot of learning and commerce, different cultures peacefully and productively interacting. In the context of Java "different cultures” ~= “foreign programming models”.</div>
<div><br>
</div>
<div>Also, from Wikipedia:</div>
<div><br>
</div>
<div>"</div>
<div>Babylon 5 – A science fiction series set on a futuristic space station that acts as a trading and diplomatic nexus between many different cultures. ...</div>
"</div>
<div><br>
</div>
<div>Paul.</div>
<div><br>
<blockquote type="cite">
<div>
<div dir="ltr">
<div class="gmail_default" style="font-family:monospace">Thank you for your time and help!</div>
<div class="gmail_default" style="font-family:monospace">David Alayachew<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, Sep 6, 2023 at 2:30 PM Paul Sandoz <<a href="mailto:paul.sandoz@oracle.com">paul.sandoz@oracle.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I hereby invite discussion of a new Project, Babylon, whose primary goal<br>
will be to extend the reach of Java to foreign programming models such as <br>
SQL, differentiable programming, machine learning models, and GPUs.<br>
<br>
Focusing on the last example, suppose a Java developer wants to write a GPU <br>
kernel in Java and execute it on a GPU. The developer’s Java code must, <br>
somehow, be analyzed and transformed into an executable GPU kernel. A Java <br>
library could do that, but it requires access to the Java code in symbolic <br>
form. Such access is, however, currently limited to the use of non-standard <br>
APIs or to conventions at different points in the program’s life cycle <br>
(compile time or run time), and the symbolic forms available (abstract <br>
syntax trees or bytecodes) are often ill-suited to analysis and transformation.<br>
<br>
Babylon will extend Java's reach to foreign programming models with an <br>
enhancement to reflective programming in Java, called code reflection. This <br>
will enable standard access, analysis, and transformation of Java code in a <br>
suitable form. Support for a foreign programming model can then be more <br>
easily implemented as a Java library.<br>
<br>
Babylon will ensure that code reflection is fit for purpose by creating a <br>
GPU programming model for Java that leverages code reflection and is <br>
implemented as a Java library. To reduce the risk of bias we will also <br>
explore, or encourage the exploration of, other programming models such as <br>
SQL and differentiable programming, though we may do so less thoroughly.<br>
<br>
Code reflection consists of three parts:<br>
<br>
1) The modeling of Java programs as code models, suitable for access,<br>
   analysis, and transformation.<br>
2) Enhancements to Java reflection, enabling access to code models at compile<br>
   time and run time.<br>
3) APIs to build, analyze, and transform code models.<br>
<br>
For further details please see the JVM Language Summit 2023 presentations <br>
entitled "Code Reflection" [1] and "Java and GPU … are we nearly there yet?" <br>
[2].<br>
<br>
I propose to lead this Project with an initial set of Reviewers that<br>
includes, but is not limited to, Maurizio Cimadamore, Gary Frost, and<br>
Sandhya Viswanathan.<br>
<br>
For code reflection this Project will start with a clone of the current JDK <br>
main-line release, JDK 22, and track main-line releases going forward.<br>
For the GPU programming model this Project will create a separate repository,<br>
that is dependent on code reflection features as they are developed.<br>
<br>
We expect to deliver Babylon over time, in a series of JEPs that will likely<br>
span multiple feature releases.<br>
We do not currently plan to deliver the GPU programming model into the JDK.<br>
However, work on that model could identify JDK features and enhancements of <br>
general utility which could be addressed in future work.<br>
<br>
Comments?<br>
<br>
Paul.<br>
<br>
[1] <a href="https://cr.openjdk.org/~psandoz/conferences/2023-JVMLS/Code-Reflection-JVMLS-23-08-07.pdf" rel="noreferrer" target="_blank">
https://cr.openjdk.org/~psandoz/conferences/2023-JVMLS/Code-Reflection-JVMLS-23-08-07.pdf</a><br>
    <a href="https://urldefense.com/v3/__https://youtu.be/xbk9_6XA_IY__;!!ACWV5N9M2RV99hQ!NstAlzXLu-PTlulnftpbVcuivlSqePn7f_NM-IDWDwCjcs_xsfoTTQ-wrq5_Op2jnjqemafRO38L5qHSMjpc0ppHmw$" rel="noreferrer" target="_blank">
https://youtu.be/xbk9_6XA_IY</a><br>
<br>
[2] <a href="https://urldefense.com/v3/__https://youtu.be/lbKBu3lTftc__;!!ACWV5N9M2RV99hQ!NstAlzXLu-PTlulnftpbVcuivlSqePn7f_NM-IDWDwCjcs_xsfoTTQ-wrq5_Op2jnjqemafRO38L5qHSMjqe26PY1A$" rel="noreferrer" target="_blank">
https://youtu.be/lbKBu3lTftc</a><br>
<br>
</blockquote>
</div>
</div>
</blockquote>
</div>
<br>
</body>
</html>