Closed yingsu00 closed 3 years ago
I'm not sure I've ever tried using a standard JVM to build Graal. I think it can be done but it might need some configuration. Most people would use a special JVMCI build of OpenJDK https://github.com/graalvm/labs-openjdk-11/releases.
Are you building GraalVM with GraalVM? I don't think that's the normal use case.
You should get a JVMCI JDK (from the link above) and set JAVA_HOME
to it. EXTRA_JAVA_HOMES
is not necessary here.
@chrisseaton @oraluben Thank you very much. Using the JVMCI JDK works. Does that mean I need to use the JVMCI JDK for my application in order to define my own intrinsic and run on GraalVM ?
You should use JVMCI JDK to build - at the least just to avoid annoying configuration problems and things.
You can run on a recent standard Java I think - it needs some flags and things and isn't always compatible.
What are you trying to achieve? I'd use a GraalVM to run your application unless you've got some special reason or constraint why you can't. It'll just be an easier path all around.
You should use JVMCI JDK to build - at the least just to avoid annoying configuration problems and things.
You can run on a recent standard Java I think - it needs some flags and things and isn't always compatible.
What are you trying to achieve? I'd use a GraalVM to run your application unless you've got some special reason or constraint why you can't. It'll just be an easier path all around.
@chrisseaton Thanks Chris. I'm trying to build compiler intrinsics that supports AVX instructions and use them in my Java application. What build process and configuration do you recommend?
I'd recommend building using JVMCI, and then running your application using the GraalVM you just built.
@chrisseaton Chris, Thank you for answering my questions. There are a few more questions that I have:
I'd like to call some SIMD intrinsics in my application. For example, I want to call BMI instruction PDEP and PEXT in my Java application. To do this I'm thinking to create a BMI2Node
which contains a @NodeIntrinsic public static native BigInteger compute(op, value, mask)
that emits the masm code, then in my application I can call BMI2Node.compute(PDEP, value, mask)
. Is this supposed to work?
I tried to call an existing NodeIntrinsic to test my idea above:
public static void main(String[] args) {
int[] array = new int[100];
System.out.println(OffsetAddressNode.address(array, 0));
}
But this doesn't work:
java: package org.graalvm.compiler.nodes.memory.address is not visible
(package org.graalvm.compiler.nodes.memory.address is declared in module jdk.internal.vm.compiler, which is not in the module graph)
So I wonder if this is possible at all? If yes what's the right way to do it?
ps. I was following the "Compiler Intrinsics" section in https://www.slideshare.net/ThomasWuerthinger/2015-cgo-graal?from_action=save but the example in this talk is no longer available in GraalTutorial.java. I wonder if you can point me to some examples so that I can call SIMD instructions in the application level? If this is possible it will certainly open a new world for the Java community.
Sorry you've sort of exceeded my working knowledge there without spending a lot of time looking into it. Hopefully someone working on this part of the project will address this issue.
I believe @dougxc can either provide some insight or pinpoint someone who can. @dougxc Would you mind taking a look at this?
Please state the JDK you are using (i.e. what does $JAVA_HOME/bin/java -version
print out), as well as the full command line for your test.
Please re-open once a reproducer can be provided.
Describe the issue mx build for graal/compiler failed on MacOS
Steps to reproduce the issue git clone git@github.com:yingsu00/graal.git git clone git@github.com:graalvm/mx.git export PATH=$PWD/mx:$PATH cd ~/graal/compiler mx build
Describe GraalVM and your environment:
More details Note that all the files in
/Library/Java/JavaVirtualMachines/graalvm-ce-java11-21.0.0/Contents/Home/jmods
are actually there but the mx build was unable to read them.