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

Calling Dex code from Julia via sharing LLVM bitcode #634

Open
oxinabox opened this issue Aug 25, 2021 · 5 comments
Open

Calling Dex code from Julia via sharing LLVM bitcode #634

oxinabox opened this issue Aug 25, 2021 · 5 comments
Labels
julia Julia bindings

Comments

@oxinabox
Copy link
Contributor

From #625 (review)

Also, doesn't Julia use LLVM for compilation too? I wonder if it would be possible to lower Dex functions to LLVM modules and link those together with the larger Julia programs. That would give you essentially no FFI boundary but would all get compiled into a single binary blob!

I asked @vchuravy about how realistic that was and they said:

It is how Cxx.jl works
There is some version dependency
I.e. you want to use the same LLVM version
Otherwise once you have the bitcode it's straightforward

Apparently, this is not a reason Cxx.jl is incredibly fragile.
So this seems possible.

Normal builds of Julia 1.6 is LLVM v11, Julia 1.7 is LLVM v12.
I think there is a long of swing possible when compiling from source but its pretty rare for people to do that and so don't want to depend on it.

@vchuravy
Copy link

We could start with adding dex to Yggdrasil, building against our specific LLVM there.

@MasonProtter
Copy link

MasonProtter commented Aug 25, 2021

Julia needs a patched LLVM. Are those patches compatible with Dex? Does it have its own patches?

@oxinabox
Copy link
Contributor Author

I think Julia's LLVM is not very patched?
Just a little bit.
People on some distributions run it without the patchs.
Because the distribution maintainers hate that.

I would expect that they still can talk same bytecode?
@vchuravy is the expert here though.

Dex does not use any patches on llvm afaik.
But I would expect it would run happily enough on llvm with Julia's patches

@vchuravy
Copy link

We should still be bitcode compatible with an unpatched version, as long as the optimizations are run by the Julia LLVM, (and we are upstreaming our patch list)

@apaszke
Copy link
Collaborator

apaszke commented Aug 26, 2021

Yeah we don't need any LLVM changes. If the Julia patches are minor then I don't expect any significant difficulties. Right now we can support LLVM 9 or LLVM HEAD, but it shouldn't be hard to add LLVM 12 support as well.

@apaszke apaszke added the julia Julia bindings label Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
julia Julia bindings
Projects
None yet
Development

No branches or pull requests

4 participants