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

Testing Julia pipeline in isolation via opt leads to invalid IR #55010

Open
topolarity opened this issue Jul 3, 2024 · 2 comments
Open

Testing Julia pipeline in isolation via opt leads to invalid IR #55010

topolarity opened this issue Jul 3, 2024 · 2 comments
Labels
domain:docs This change adds or pertains to documentation

Comments

@topolarity
Copy link
Member

I followed the instructions at https://docs.julialang.org/en/v1.12-dev/devdocs/llvm/#Debugging-LLVM-transformations-in-isolation to do some Julia pass debugging.

optimize = false
fun, T = iterate, Tuple{Base.ANSIIterator, Tuple{Int64, Tuple{Base.RegexMatch{String}, Tuple{Int64, Bool}}}}
open("iterate.ll", "w") do file
    println(file, InteractiveUtils._dump_function(fun, T, false, false, false, true, :att, optimize, :default, false))
end

It looks like this is not a correct workflow, since it leads to invalid IR when trying to run opt:

$ ./usr/tools/opt -load-pass-plugin=usr/lib/libjulia-codegen.so --passes='julia' -o iterate_opt.bc iterate.ll
Invalid derived pointer in jlcall
          %35 = call nonnull ptr (ptr, ptr, ...) @julia.call(ptr @ijl_apply_generic, ptr %"+Core.BoundsError#596", ptr %"box::SubString193", ptr %box_Int64195)
Invalid derived pointer in jlcall
          %35 = call nonnull ptr (ptr, ptr, ...) @julia.call(ptr @ijl_apply_generic, ptr %"+Core.BoundsError#596", ptr %"box::SubString193", ptr %box_Int64195)
Invalid derived pointer in jlcall
          %184 = call nonnull ptr (ptr, ptr, ...) @julia.call(ptr @ijl_apply_generic, ptr %"+Core.ArgumentError#561", ptr %"jl_global#562")
Invalid derived pointer in jlcall
          %265 = call nonnull ptr (ptr, ptr, ...) @julia.call(ptr @ijl_apply_generic, ptr %"+Core.ArgumentError#56125", ptr %"jl_global#568")
Invalid derived pointer in jlcall
          %290 = call nonnull ptr (ptr, ptr, ...) @julia.call(ptr @ijl_apply_generic, ptr %"jl_global#571", ptr %"I::ANSIIterator.captures", ptr %"box::Tuple")
Invalid derived pointer in jlcall
          %290 = call nonnull ptr (ptr, ptr, ...) @julia.call(ptr @ijl_apply_generic, ptr %"jl_global#571", ptr %"I::ANSIIterator.captures", ptr %"box::Tuple")
Invalid derived pointer in jlcall
          %jl_f_tuple_ret = call nonnull ptr (ptr, ptr, ...) @julia.call(ptr @jl_f_tuple, ptr null, ptr %box_Int64, ptr %290)
Invalid derived pointer in jlcall
          %jl_f_tuple_ret = call nonnull ptr (ptr, ptr, ...) @julia.call(ptr @jl_f_tuple, ptr null, ptr %box_Int64, ptr %290)
Invalid derived pointer in jlcall
          %jl_f_tuple_ret46 = call nonnull ptr (ptr, ptr, ...) @julia.call(ptr @jl_f_tuple, ptr null, ptr %295, ptr %jl_f_tuple_ret)
Invalid derived pointer in jlcall
          %jl_f_tuple_ret46 = call nonnull ptr (ptr, ptr, ...) @julia.call(ptr @jl_f_tuple, ptr null, ptr %295, ptr %jl_f_tuple_ret)
PLEASE submit a bug report to https://github.com/julialang/julia and include the crash backtrace.
@gbaraldi
Copy link
Member

gbaraldi commented Jul 3, 2024

You need raw=true which I think thoose docs don't have.

@topolarity
Copy link
Member Author

Aha! Yes, that seems to do the trick.

@Seelengrab Seelengrab added the domain:docs This change adds or pertains to documentation label Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:docs This change adds or pertains to documentation
Projects
None yet
Development

No branches or pull requests

3 participants