<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>cc: <br>
</p>
<div class="moz-cite-prefix">On 24/06/2024 16:24, Juan Fumero wrote:<br>
</div>
<blockquote type="cite"
cite="mid:614a3bec-e30a-4383-ba7a-1d2eb82bcd43@paravox.ai">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<p>Thanks Gary, <br>
</p>
<p> I will take a look at the pom files. <br>
</p>
<p><br>
</p>
<p>Another question. Going a bit deeper into the KernelContext (I
guess an inspired by TornadoVM Data Structure), is the any
variant to represent a 2D NDRange?<br>
</p>
<p><br>
</p>
<p><a class="moz-txt-link-freetext"
href="https://github.com/openjdk/babylon/blob/e7ada25d4c01c76461bf5cd73b928138050f11f8/hat/examples/experiments/src/main/java/experiments/spirv/MatrixMultiply.java#L77"
moz-do-not-send="true">https://github.com/openjdk/babylon/blob/e7ada25d4c01c76461bf5cd73b928138050f11f8/hat/examples/experiments/src/main/java/experiments/spirv/MatrixMultiply.java#L77</a>
<br>
</p>
<p><br>
</p>
<p>I wanted to run some examples with 2D Matrix Multiplication. <br>
</p>
<p><br>
</p>
<p>I guess:</p>
<p><br>
</p>
<p>```java</p>
<div style="background-color:#1e1f22;color:#bcbec4">
<pre
style="font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><span
style="color:#cf8e6d;">public class </span>KernelContext {
<span style="color:#cf8e6d;">public final </span>NDRange <span
style="color:#c77dbb;">ndRange</span>;
<span style="color:#cf8e6d;">public int </span><span
style="color:#c77dbb;">x</span>;
<span style="color:#cf8e6d;">public final int </span><span
style="color:#c77dbb;">maxX</span>;
<span style="color:#cf8e6d;">public </span><span
style="color:#56a8f5;">KernelContext</span>(NDRange ndRange, <span
style="color:#cf8e6d;">int </span>maxX, <span
style="color:#cf8e6d;">int </span>x) {
<span style="color:#cf8e6d;">this</span>.<span
style="color:#c77dbb;">ndRange </span>= ndRange;
<span style="color:#cf8e6d;">this</span>.<span
style="color:#c77dbb;">maxX </span>= maxX;
<span style="color:#cf8e6d;">this</span>.<span
style="color:#c77dbb;">x </span>= x;
}
}</pre>
</div>
<p>```</p>
<p><br>
</p>
<p>The NDRange object itself can return `maxX`, `maxY` and `maxZ`
for each dimension as well as the thread-id per dimension. Could
this be the way to go? <br>
</p>
<p><br>
</p>
<p>In TornadoVM, we have the concept of `WorkerGrid` [1], which
can be 1D, 2D or 3D as a sub-type.</p>
<p>The `KernelContext` [2] gives us access to the corresponding
thread-ids as well as access to barriers, local memory (in
OpenCL terms), etc. <br>
</p>
<p><br>
</p>
<p>[1]
<a class="moz-txt-link-freetext"
href="https://github.com/beehive-lab/TornadoVM/blob/master/tornado-api/src/main/java/uk/ac/manchester/tornado/api/WorkerGrid.java#L20"
moz-do-not-send="true">https://github.com/beehive-lab/TornadoVM/blob/master/tornado-api/src/main/java/uk/ac/manchester/tornado/api/WorkerGrid.java#L20</a>
<br>
</p>
<p>[2]
<a class="moz-txt-link-freetext"
href="https://github.com/beehive-lab/TornadoVM/blob/master/tornado-api/src/main/java/uk/ac/manchester/tornado/api/KernelContext.java"
moz-do-not-send="true">https://github.com/beehive-lab/TornadoVM/blob/master/tornado-api/src/main/java/uk/ac/manchester/tornado/api/KernelContext.java</a><br>
</p>
<p><br>
</p>
<p><br>
</p>
<p>Thanks<br>
</p>
<p>Juan<br>
</p>
<p><br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 24/06/2024 15:57, Gary Frost
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:MN2PR10MB43651C2512A3C3591A137451FCD42@MN2PR10MB4365.namprd10.prod.outlook.com">
<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8">
<style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
<div class="elementToProof"
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hey Juan<br>
<br>
I would like to see your top level pom.xml<br>
<br>
Specifically the pom.xml...properties which usually have these
defaults<br>
<br>
<properties></div>
<div class="elementToProof"
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<babylon.repo.name>babylon</babylon.repo.name>
<!--replace with your fork name --></div>
<div
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></div>
<div class="elementToProof"
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<maven.compiler.source>23</maven.compiler.source></div>
<div
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<maven.compiler.target>23</maven.compiler.target></div>
<div class="elementToProof"
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<github.dir>${env.HOME}/github</github.dir></div>
<div class="elementToProof"
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof"
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<beehive.spirv.toolkit.dir>${github.dir}/beehive-spirv-toolkit/</beehive.spirv.toolkit.dir></div>
<div class="elementToProof"
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<babylon.dir>${github.dir}/${babylon.repo.name}</babylon.dir></div>
<div class="elementToProof"
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<hat.dir>${babylon.dir}/hat</hat.dir></div>
<div class="elementToProof"
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<hat.target>${hat.dir}/maven-build</hat.target></div>
<div class="elementToProof"
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
</properties><br>
<br>
Which assumes a layout under github which looks like this.<br>
<br>
github/<br>
babylon/<br>
build/<br>
YOUR_OS-YOUR_ARCH-server-release<br>
hat/<br>
beehive-spirv-toolkit/<br>
<br>
<br>
Yours might be something like this.<br>
<br>
github/<br>
babylon/<br>
babylon/ <---?<br>
build/<br>
YOUR_OS-YOUR_ARCH-server-release<br>
hat/<br>
beehive-spirv-toolkit/<br>
<br>
In which case you may need<br>
<babylon.dir>${github.dir}/babylon/${babylon.repo.name}</babylon.dir><br>
<br>
Most important is that ${babylon.dir}/hat == ${hat.dir}<br>
<br>
There is a 'sanity.java' script in the hat root. Which
(hopefully) can just be run via java (23) directly<br>
<br>
java sanity.java<br>
<br>
Which will attempt to sanity check your pom properties. I
switch repos frequently, and this script has saved my bacon a
few times.<br>
<br>
The native code (C++/C) in the SPIRV backend is essentially a
mock backend, enough to load the lib and hook up the 'native
trampoline' points. My idea was that someone 😉 would crib
from the OpenCL one, or build a HIP or Level0 variant... <br>
<br>
Gary<br>
<br>
<br>
<br>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
face="Calibri, sans-serif" color="#000000"><b>From:</b>
babylon-dev <a class="moz-txt-link-rfc2396E"
href="mailto:babylon-dev-retn@openjdk.org"
moz-do-not-send="true"><babylon-dev-retn@openjdk.org></a>
on behalf of Juan Fumero <a class="moz-txt-link-rfc2396E"
href="mailto:juan.fumero@paravox.ai"
moz-do-not-send="true"><juan.fumero@paravox.ai></a><br>
<b>Sent:</b> Monday, June 24, 2024 2:29 PM<br>
<b>To:</b> <a
class="moz-txt-link-abbreviated moz-txt-link-freetext"
href="mailto:babylon-dev@openjdk.org"
moz-do-not-send="true">babylon-dev@openjdk.org</a> <a
class="moz-txt-link-rfc2396E"
href="mailto:babylon-dev@openjdk.org"
moz-do-not-send="true"><babylon-dev@openjdk.org></a><br>
<b>Subject:</b> Some questions about HAT and Babylon</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span
style="font-size:11pt;">
<div class="PlainText">Hi all,<br>
<br>
I am building and testing a few examples and I have
a few questions:<br>
<br>
<br>
1) During the installation of the HAT component, the JAR
files and <br>
binaries where place under the $HOME directory, instead
of under the HAT <br>
sub directory within Babylon:<br>
<br>
For example, in my case, the installation was copied
here:<br>
<br>
/home/juan/github/babylon/hat/maven-build<br>
<br>
<br>
However, my Babylon install is here:<br>
<br>
/home/juan/repos/hat/babylon/babylon<br>
<br>
<br>
2) I saw the C-code code of HAT, I noticed that there
are several <br>
directories per backend. One for OpenCL, PTX, etc.
SPIR-V is also a <br>
directory. However, SPIR-V is an intermediate
representation and it is <br>
dispatched via a) OpenCL, or b) Level Zero. Is there any
reason why <br>
SPIR-V has this C-library?<br>
<br>
<br>
I hope to find more time during the week to do some
testing.<br>
<br>
<br>
Kind regards,<br>
<br>
Juan<br>
<br>
<br>
</div>
</span></font></div>
</blockquote>
</blockquote>
</body>
</html>