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

Does llvmlite support riscv64? #923

Open
yuzibo opened this issue Mar 18, 2023 · 4 comments
Open

Does llvmlite support riscv64? #923

yuzibo opened this issue Mar 18, 2023 · 4 comments
Labels

Comments

@yuzibo
Copy link

yuzibo commented Mar 18, 2023


Feature request

Hi,

On Debian riscv64, I noticed the llvmlite never built due to test failed:

test_add_module (llvmlite.tests.test_binding.TestGlobalConstructors.test_add_module) ... WARNING: This target JIT is not designed for the host you are running.  If bad things happen, please choose a different -march switch.
ok
test_add_module_lifetime (llvmlite.tests.test_binding.TestGlobalConstructors.test_add_module_lifetime) ... WARNING: This target JIT is not designed for the host you are running.  If bad things happen, please choose a different -march switch.
ok
test_add_module_lifetime2 (llvmlite.tests.test_binding.TestGlobalConstructors.test_add_module_lifetime2) ... WARNING: This target JIT is not designed for the host you are running.  If bad things happen, please choose a different -march switch.
ok
test_close (llvmlite.tests.test_binding.TestGlobalConstructors.test_close) ... WARNING: This target JIT is not designed for the host you are running.  If bad things happen, please choose a different -march switch.
ok
test_emit_assembly (llvmlite.tests.test_binding.TestGlobalConstructors.test_emit_assembly)
Test TargetMachineRef.emit_assembly() ... WARNING: This target JIT is not designed for the host you are running.  If bad things happen, please choose a different -march switch.
ok
test_emit_object (llvmlite.tests.test_binding.TestGlobalConstructors.test_emit_object)
Test TargetMachineRef.emit_object() ... WARNING: This target JIT is not designed for the host you are running.  If bad things happen, please choose a different -march switch.
ok
test_global_ctors_dtors (llvmlite.tests.test_binding.TestGlobalConstructors.test_global_ctors_dtors) ... WARNING: This target JIT is not designed for the host you are running.  If bad things happen, please choose a different -march switch.
LLVM ERROR: Unsupported code model for lowering
Aborted
E: pybuild pybuild:388: test: plugin distutils failed with: exit code=134: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_llvmlite/build; python3.11 -m unittest discover -v
...

From the commit, we can support riscv binding test, but only for riscv32, right? Is this a chance to add support riscv64? If yes, What direction should we go? Ihave real riscv64 hardware, please tell me if I can help here.

Sorry, I am very new to llvmlite so please correct me if I am misundering here.

@gmarkall
Copy link
Member

Support for riscv64 is getting there but not quite complete yet (any use of it should be considered experimental at this stage). The status is:

I'm quite keen to push forward on RISC-V support, but it is a just a personal project for me so I've not been able to spend a great deal of time on it. Initially I got things tested / brought up with qemu, but I've since been using a Starfive VisionFive 2. What hardware are you using?

From the commit, we can support riscv binding test, but only for riscv32, right? Is this a chance to add support riscv64? If yes, What direction should we go? Ihave real riscv64 hardware, please tell me if I can help here.

That commit tests assembly code generation for riscv32, it doesn't necessarily imply llvmlite runs on riscv32 (though it may well run as well as on riscv64). I haven't come across a Linux-capable riscv32 system yet (that's not in an FPGA or qemu) - have you seen one?

@yuzibo
Copy link
Author

yuzibo commented Mar 23, 2023

hi, sorry for the late reply.
Thanks for your share about supporting the riscv64 status. Very much appreciate for your work.

The rest of the binding layer mostly doesn't work OOTB, because MCJIT and RuntimeDyld (used by the current JIT implementation) don't support RISC-V

Here, could you give more info/hit? So maybe more people know where to start?

What hardware are you using?

I have a real riscv64 hardware(Unmatched board) by hand to test/build some Debian packages.
I am a Debian riscv64 porter so I have to face to many packages with build/test issues on Debian riscv64. llvmlite is one of these packages.:)

When we have a plan to push the patch that support RISC-V JIT on llvm-14 to upstream? Since I'm not familiar with the details of this, so my assumption might be wrong.

I will cost some time to test patch support RISC-V jit but I am very new to llvm. I want to help here but maybe cost a long time.:(

I haven't come across a Linux-capable riscv32 system yet (that's not in an FPGA or qemu) - have you seen one?
Very bad. I have setup riscv32 qemu via yocto. I think this is very inconvenient for developers.

Thanks again for your work!

@gmarkall
Copy link
Member

Here, could you give more info/hit? So maybe more people know where to start?

I hope this helps - please let me know if you need further instructions / clarification.

When we have a plan to push the patch that support RISC-V JIT on llvm-14 to upstream? Since I'm not familiar with the details of this, so my assumption might be wrong.

We don't need to do this - the branch I pointed to you is just me backporting fixes that are already in LLVM 15 to LLVM 14. llvmlite will move to LLVM 15 in the future.

I will cost some time to test patch support RISC-V jit but I am very new to llvm. I want to help here but maybe cost a long time.:(

I'd like to help support you in doing this - if you have any trouble with it, please reach out to me and I'll try to guide you.

Thanks again for your work!

Thanks for your interest!

@yuzibo
Copy link
Author

yuzibo commented Mar 24, 2023

Ok, I will try it and thanks for your help here.:)

felixonmars added a commit to felixonmars/archriscv-packages that referenced this issue Jun 23, 2023
Skip MCJIT related tests. Upstream issue about riscv64 support:
numba/llvmlite#923
felixonmars added a commit to felixonmars/archriscv-packages that referenced this issue Jun 23, 2023
Skip MCJIT related tests. Upstream issue about riscv64 support:
numba/llvmlite#923
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants