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

[LLVM] Parsing bitcode bug when running Ruby MRI: Invalid ElementType of Vector failure #3184

Closed
jeshan opened this issue Feb 4, 2021 · 5 comments
Assignees

Comments

@jeshan
Copy link

jeshan commented Feb 4, 2021

Describe GraalVM and your environment :

  • GraalVM version or commit id if built from source: 21.0
  • CE or EE: CE
  • JDK version: JDK11
  • OS and OS Version: GNU/Linux
  • Architecture: amd64 (Running in Docker actually)
  • The output of java -Xinternalversion:

OpenJDK 64-Bit Server VM (11.0.10+8-jvmci-21.0-b06) for linux-amd64 JRE (11.0.10+8-jvmci-21.0-b06), built on Jan 15 2021 11:41:46 by "buildslave" with gcc 7.3.0

Step 14/19 : RUN $GRAALVM_HOME/bin/lli `which ruby` --version
 ---> Running in 7dd75eb28c18
ERROR: java.lang.AssertionError: Invalid ElementType of Vector: VariableBitWidthType
org.graalvm.polyglot.PolyglotException: java.lang.AssertionError: Invalid ElementType of Vector: VariableBitWidthType
	at com.oracle.truffle.llvm.runtime.types.VectorType.setElementType(VectorType.java:80)
	at com.oracle.truffle.llvm.parser.listeners.Types.setType(Types.java:246)
	at com.oracle.truffle.llvm.parser.listeners.Types.record(Types.java:171)
	at com.oracle.truffle.llvm.parser.scanner.LLVMScanner.passRecordToParser(LLVMScanner.java:434)
	at com.oracle.truffle.llvm.parser.scanner.LLVMScanner.unabbreviatedRecord(LLVMScanner.java:450)
	at com.oracle.truffle.llvm.parser.scanner.LLVMScanner.scanToOffset(LLVMScanner.java:164)
	at com.oracle.truffle.llvm.parser.scanner.LLVMScanner.scanToEnd(LLVMScanner.java:143)
	at com.oracle.truffle.llvm.parser.scanner.LLVMScanner.parseBitcode(LLVMScanner.java:102)
	at com.oracle.truffle.llvm.ParserDriver.parseBinary(ParserDriver.java:340)
	at com.oracle.truffle.llvm.ParserDriver.parseLibraryWithSource(ParserDriver.java:398)
	at com.oracle.truffle.llvm.ParserDriver.parseWithDependencies(ParserDriver.java:144)
	at com.oracle.truffle.llvm.ParserDriver.parseWithDependencies(ParserDriver.java:130)
	at com.oracle.truffle.llvm.ParserDriver.parse(ParserDriver.java:101)
	at com.oracle.truffle.llvm.DefaultLoader.load(DefaultLoader.java:45)
	at com.oracle.truffle.llvm.runtime.LLVMLanguage.parse(LLVMLanguage.java:480)
	at com.oracle.truffle.api.TruffleLanguage$ParsingRequest.parse(TruffleLanguage.java:848)
	at com.oracle.truffle.api.TruffleLanguage.parse(TruffleLanguage.java:1502)
	at com.oracle.truffle.api.LanguageAccessor$LanguageImpl.parse(LanguageAccessor.java:311)
	at com.oracle.truffle.polyglot.PolyglotSourceCache.parseImpl(PolyglotSourceCache.java:94)
	at com.oracle.truffle.polyglot.PolyglotSourceCache.access$300(PolyglotSourceCache.java:56)
	at com.oracle.truffle.polyglot.PolyglotSourceCache$WeakCache.lookup(PolyglotSourceCache.java:223)
	at com.oracle.truffle.polyglot.PolyglotSourceCache.parseCached(PolyglotSourceCache.java:80)
	at com.oracle.truffle.polyglot.PolyglotLanguageContext.parseCached(PolyglotLanguageContext.java:371)
	at com.oracle.truffle.polyglot.EngineAccessor$EngineImpl.parseForLanguage(EngineAccessor.java:242)
	at com.oracle.truffle.api.TruffleLanguage$Env.parseInternal(TruffleLanguage.java:2471)
	at com.oracle.truffle.llvm.initialization.LoadModulesNode.execute(LoadModulesNode.java:188)
	at <llvm> <LoadModulesNode>(Unknown)
	at org.graalvm.polyglot.Context.eval(Context.java:347)
	at com.oracle.truffle.llvm.launcher.LLVMLauncher.execute(LLVMLauncher.java:249)
	at com.oracle.truffle.llvm.launcher.LLVMLauncher.launch(LLVMLauncher.java:75)
	at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:124)
	at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:71)
	at com.oracle.truffle.llvm.launcher.LLVMLauncher.main(LLVMLauncher.java:53)
Original Internal Error: 
java.lang.AssertionError: Invalid ElementType of Vector: VariableBitWidthType
	at com.oracle.truffle.llvm.runtime.types.VectorType.setElementType(VectorType.java:80)
	at com.oracle.truffle.llvm.parser.listeners.Types.setType(Types.java:246)
	at com.oracle.truffle.llvm.parser.listeners.Types.record(Types.java:171)
	at com.oracle.truffle.llvm.parser.scanner.LLVMScanner.passRecordToParser(LLVMScanner.java:434)
	at com.oracle.truffle.llvm.parser.scanner.LLVMScanner.unabbreviatedRecord(LLVMScanner.java:450)
	at com.oracle.truffle.llvm.parser.scanner.LLVMScanner.scanToOffset(LLVMScanner.java:164)
	at com.oracle.truffle.llvm.parser.scanner.LLVMScanner.scanToEnd(LLVMScanner.java:143)
	at com.oracle.truffle.llvm.parser.scanner.LLVMScanner.parseBitcode(LLVMScanner.java:102)
	at com.oracle.truffle.llvm.ParserDriver.parseBinary(ParserDriver.java:340)
	at com.oracle.truffle.llvm.ParserDriver.parseLibraryWithSource(ParserDriver.java:398)
	at com.oracle.truffle.llvm.ParserDriver.parseWithDependencies(ParserDriver.java:144)
	at com.oracle.truffle.llvm.ParserDriver.parseWithDependencies(ParserDriver.java:130)
	at com.oracle.truffle.llvm.ParserDriver.parse(ParserDriver.java:101)
	at com.oracle.truffle.llvm.DefaultLoader.load(DefaultLoader.java:45)
	at com.oracle.truffle.llvm.runtime.LLVMLanguage.parse(LLVMLanguage.java:480)
	at com.oracle.truffle.api.TruffleLanguage$ParsingRequest.parse(TruffleLanguage.java:848)
	at com.oracle.truffle.api.TruffleLanguage.parse(TruffleLanguage.java:1502)
	at com.oracle.truffle.api.LanguageAccessor$LanguageImpl.parse(LanguageAccessor.java:311)
	at com.oracle.truffle.polyglot.PolyglotSourceCache.parseImpl(PolyglotSourceCache.java:94)
	at com.oracle.truffle.polyglot.PolyglotSourceCache.access$300(PolyglotSourceCache.java:56)
	at com.oracle.truffle.polyglot.PolyglotSourceCache$WeakCache.lookup(PolyglotSourceCache.java:223)
	at com.oracle.truffle.polyglot.PolyglotSourceCache.parseCached(PolyglotSourceCache.java:80)
	at com.oracle.truffle.polyglot.PolyglotLanguageContext.parseCached(PolyglotLanguageContext.java:371)
	at com.oracle.truffle.polyglot.EngineAccessor$EngineImpl.parseForLanguage(EngineAccessor.java:242)
	at com.oracle.truffle.api.TruffleLanguage$Env.parseInternal(TruffleLanguage.java:2471)
	at com.oracle.truffle.llvm.initialization.LoadModulesNode.execute(LoadModulesNode.java:188)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.executeRootNode(OptimizedCallTarget.java:591)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.profiledPERoot(OptimizedCallTarget.java:562)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:512)
	at com.oracle.svm.truffle.api.SubstrateOptimizedCallTarget.invokeCallBoundary(SubstrateOptimizedCallTarget.java:121)
	at com.oracle.svm.truffle.api.SubstrateOptimizedCallTargetInstalledCode.doInvoke(SubstrateOptimizedCallTargetInstalledCode.java:165)
	at com.oracle.svm.truffle.api.SubstrateOptimizedCallTarget.doInvoke(SubstrateOptimizedCallTarget.java:104)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callIndirect(OptimizedCallTarget.java:446)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.call(OptimizedCallTarget.java:434)
	at com.oracle.truffle.polyglot.PolyglotContextImpl.eval(PolyglotContextImpl.java:941)
	at org.graalvm.polyglot.Context.eval(Context.java:347)
	at com.oracle.truffle.llvm.launcher.LLVMLauncher.execute(LLVMLauncher.java:249)
	at com.oracle.truffle.llvm.launcher.LLVMLauncher.launch(LLVMLauncher.java:75)
	at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:124)
	at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:71)
	at com.oracle.truffle.llvm.launcher.LLVMLauncher.main(LLVMLauncher.java:53)
Caused by: Attached Guest Language Frames (1)

Have you verified this issue still happens when using the latest snapshot?
I have not.

Describe the issue
Attempting to run Ruby MRI 2.7.2 with lli gives the above stacktrace.

How to compile the LLVM bitcode that causes the problem

  • Did you use the bundled llvm toolchain for compiling to LLVM bicode (see lli --print-toolchain-path)? Yes

Code snippet or code repository that reproduces the problem
I'm providing a gist to reproduce the issue. v1 there shows the MRI's official docker image builds successfully while v2 shows the minimal changes needed to reproduce this issue.

image

Steps to reproduce the problem
Configuring MRI to use llvm toolchain like this, then run the output program on Sulong:

CC=$GRAALVM_HOME/languages/llvm/native/bin/clang cflags="-flto=full" ./configure \
		--build="$gnuArch" \
		--disable-install-doc \
		--enable-shared \
		--with-out-ext=bigdecimal # this is just to work around an unrelated issue

Example commands that fails in the Docker image:
$GRAALVM_HOME/bin/lli which ruby
$GRAALVM_HOME/bin/lli which ruby --version

Expected behavior
I was expecting ruby --version to show ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux] but Sulong crashes, showing only the stacktrace mentioned.

Additional context
This issue has been moved from a comment in a TruffleRuby issue which produces the same stacktrace but with a different scenario.

@oubidar-Abderrahim
Copy link
Member

Could you please try with GraalVM docker image as a base using FROM ghcr.io/graalvm/graalvm-ce:latest? You can check all available versions here

@jeshan
Copy link
Author

jeshan commented Feb 9, 2021

I will see if I can later but please note that my gist shows the same latest Graal version (i.e 21.0.0).

@oubidar-Abderrahim
Copy link
Member

Hi.
Any news on this? is it still an issue?

@jeshan
Copy link
Author

jeshan commented Jun 2, 2021

Hi, I did my best to report this issue but my focus is elsewhere at the moment.

@oubidar-Abderrahim
Copy link
Member

Closing this issue. if this is still relevant in the latest GraalVM versions, please create a new issue and provide the required information following the template.

@oubidar-Abderrahim oubidar-Abderrahim closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants