Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows variant of Linux installer without MSys2 #6

Merged
merged 6 commits into from
Mar 26, 2024
Merged

Windows variant of Linux installer without MSys2 #6

merged 6 commits into from
Mar 26, 2024

Conversation

otabuzzman
Copy link
Contributor

This PR complements the PR for a Windows install script for the main TornadoVM repo. Details can be found there.

@CLAassistant
Copy link

CLAassistant commented Mar 19, 2024

CLA assistant check
All committers have signed the CLA.

@jjfumero jjfumero self-requested a review March 20, 2024 09:16
@jjfumero
Copy link
Member

jjfumero commented Mar 20, 2024

Thanks, I am getting an error during the execution of Level Zero on Windows 11. Did you do any extra step to enable Level Zero on the Intel Integrated Graphics?

 .\bin\Release\zello_world.exe
Driver not initialized: ZE_RESULT_ERROR_UNINITIALIZED
Did NOT find matching ZE_DEVICE_TYPE_GPU device!

README.md Outdated
cmake --build . --config Release
```

Note: Check for extisting Level Zero API libraries (e.g. `ze_tracing_layer.dll`) in `c:\windows\system32` if `zello_world.exe` fails.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is the reason why it fails for me. Can you expand what you did here in this step? you just move the file to this directory?

@jjfumero jjfumero self-assigned this Mar 20, 2024
@otabuzzman
Copy link
Contributor Author

otabuzzman commented Mar 20, 2024 via email

@jjfumero
Copy link
Member

Thank you, that did the trick. When I first installed it (a couple of years ago) this was not the case. It might be worth filing an issue in the Level Zero repo.

@otabuzzman
Copy link
Contributor Author

otabuzzman commented Mar 20, 2024 via email

@jjfumero
Copy link
Member

jjfumero commented Mar 21, 2024

I can build the library on Windows using the MS Tools. However, I get an error when I run. I am pretty sure it is my fault and I am missing something:

cmake --build . --config Release
MSBuild version 17.8.3+195e7f5a3 for .NET Framework

  tornado-levelzero.vcxproj -> C:\Users\jjfum\source\repos\levelzero-jni\levelZeroLib\build\Release\tornado-levelzero.dll

C:\Users\jjfum\source\repos\levelzero-jni\levelZeroLib\build>cd ../..

C:\Users\jjfum\source\repos\levelzero-jni>.\scripts\run.cmd

C:\Users\jjfum\source\repos\levelzero-jni>java -Djava.library.path=./levelZeroLib/build/Release -cp target/beehive-levelzero-jni-0.1.2.jar uk.ac.manchester.tornado.drivers.spirv.levelzero.samples.TestLevelZero copyData.spv
Testing Level-ZERO JNI Library
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\jjfum\source\repos\levelzero-jni\levelZeroLib\build\Release\tornado-levelzero.dll: Can't find dependent libraries
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
        at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:259)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:251)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2451)
        at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:916)
        at java.base/java.lang.System.loadLibrary(System.java:2059)
        at uk.ac.manchester.tornado.drivers.spirv.levelzero.LevelZeroDriver.<clinit>(LevelZeroDriver.java:51)
        at uk.ac.manchester.tornado.drivers.spirv.levelzero.samples.TestLevelZero.main(TestLevelZero.java:105)

Any ideas? I used to get these errors when I built the library and I have a missing name when invoking a native function, but now it seems the error is when loading the DLL.

@jjfumero
Copy link
Member

Can you please sync with the latest develop branch? So the diff just shows the new changes.

@@ -98,7 +106,11 @@ JNIEXPORT jint JNICALL Java_uk_ac_manchester_tornado_drivers_spirv_levelzero_Lev
ze_command_queue_desc_t cmdQueueDesc = {};
jclass commandDescriptorClass = env->GetObjectClass(javaCommandQueueDescriptor);
field = env->GetFieldID(commandDescriptorClass, "ptrZeCommandDescriptor", "J");
#ifdef _WIN32
int64_t ptrZeCommandDescriptor = env->GetLongField(javaCommandQueueDescriptor, field);
#else
long ptrZeCommandDescriptor = env->GetLongField(javaCommandQueueDescriptor, field);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also use int64_t in Linux as well. Let's keep it for now, I will make a note and do this after we merge, so we can unify the Windows and Linux ports as much as possible.

@jjfumero
Copy link
Member

The PR looks good to me. I need to make it work and we are ready to merge.

@otabuzzman
Copy link
Contributor Author

otabuzzman commented Mar 21, 2024 via email

@otabuzzman
Copy link
Contributor Author

otabuzzman commented Mar 21, 2024 via email

@jjfumero
Copy link
Member

Same behaviour on my system:

C:\Users\jjfum\source\repos\levelzero-jni>set ZE_SHARED_LOADER=C:\Users\jjfum\source\repos\level-zero\build\lib\release\ze_loader.lib

C:\Users\jjfum\source\repos\levelzero-jni>set CPLUS_INCLUDE_PATH=C:\Users\jjfum\source\repos\level-zero\include

C:\Users\jjfum\source\repos\levelzero-jni>set C_INCLUDE_PATH=C:\Users\jjfum\source\repos\level-zero\include

C:\Users\jjfum\source\repos\levelzero-jni>set PATH=C:\Users\jjfum\source\repos\levelzero-jni\levelZeroLib\build\Release;%PATH%

C:\Users\jjfum\source\repos\levelzero-jni> dir C:\Users\jjfum\source\repos\levelzero-jni\levelZeroLib\build\Release

 Directory of C:\Users\jjfum\source\repos\levelzero-jni\levelZeroLib\build\Release

21/03/2024  08:55    <DIR>          .
21/03/2024  08:55    <DIR>          ..
21/03/2024  08:55           303,104 tornado-levelzero.dll
21/03/2024  08:55            36,546 tornado-levelzero.exp
21/03/2024  08:55            62,140 tornado-levelzero.lib
21/03/2024  08:55         6,533,120 tornado-levelzero.pdb
               4 File(s)      6,934,910 bytes
               2 Dir(s)  434,048,061,440 bytes free

C:\Users\jjfum\source\repos\levelzero-jni> java -Djava.library.path=./levelZeroLib/build/Release -cp target/beehive-levelzero-jni-0.1.2.jar uk.ac.manchester.tornado.drivers.spirv.levelzero.samples.TestLevelZero copyData.spv
Testing Level-ZERO JNI Library
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\jjfum\source\repos\levelzero-jni\levelZeroLib\build\Release\tornado-levelzero.dll: Can't find dependent libraries
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
        at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:259)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:251)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2451)
        at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:916)
        at java.base/java.lang.System.loadLibrary(System.java:2059)
        at uk.ac.manchester.tornado.drivers.spirv.levelzero.LevelZeroDriver.<clinit>(LevelZeroDriver.java:51)
        at uk.ac.manchester.tornado.drivers.spirv.levelzero.samples.TestLevelZero.main(TestLevelZero.java:105)

@otabuzzman
Copy link
Contributor Author

otabuzzman commented Mar 21, 2024 via email

@jjfumero
Copy link
Member

Thank you @otabuzzman , That made the trick.

C:\Users\jjfum\source\repos\levelzero-jni>set PATH=C:\Users\jjfum\source\repos\level-zero\build\bin\Release;%PATH%

C:\Users\jjfum\source\repos\levelzero-jni>.\scripts\run.cmd

C:\Users\jjfum\source\repos\levelzero-jni>java -Djava.library.path=./levelZeroLib/build/Release -cp target/beehive-levelzero-jni-0.1.2.jar uk.ac.manchester.tornado.drivers.spirv.levelzero.samples.TestLevelZero copyData.spv
Testing Level-ZERO JNI Library
Driver Version: 17001183
Level Zero API Version:
=========================
Device Properties
=========================
STye                : ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES
pNext               : 0
Type                : ZE_DEVICE_TYPE_GPU
vendorId            : 32902
deviceId            : 18048
flags               : 1
subdeviceId         : 0
coreClockRate       : 1500
maxMemAllocSize     : 4294959104
maxHardwareContext  : 65536
maxCommandQueuePriority: 0
numThreadsPerEU     : 7
physicalEUSimdWidth : 8
numEUsPerSubslice   : 8
numSubslicesPerSlice: 4
numSlices           : 1
timerResolution     : 52
timestampValidBits  : 36
kernelTimestampValidBits: 32
uuid                : [134, 128, 128, 70, 12, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0]
name                : Intel(R) UHD Graphics 770

Can you please complete the README file to add these instructions?

@jjfumero
Copy link
Member

BTW, I used the latest version of Level Zero, so no need to checkout the tag 1.4

@otabuzzman
Copy link
Contributor Author

otabuzzman commented Mar 21, 2024 via email

@jjfumero jjfumero added the enhancement New feature or request label Mar 21, 2024
@jjfumero jjfumero requested a review from stratika March 25, 2024 08:35
Copy link
Member

@jjfumero jjfumero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @otabuzzman . This PR looks good to me.

@jjfumero
Copy link
Member

Let's wait until @stratika can also reproduce it and then we merge.

Copy link
Contributor

@stratika stratika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, only a small typo in CHANGELOG.md.

CHANGELOG.md Outdated Show resolved Hide resolved
@stratika
Copy link
Contributor

@jjfumero, once we do the release of 0.1.3, we need to update also the path for the target directory that will have the new jar files.

Co-authored-by: Thanos Stratikopoulos <[email protected]>
@jjfumero jjfumero merged commit 02b24de into beehive-lab:develop Mar 26, 2024
1 check passed
@otabuzzman otabuzzman deleted the winstall branch March 27, 2024 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

4 participants