ckb-vm icon indicating copy to clipboard operation
ckb-vm copied to clipboard

aarch64 compatibility

Open razum2um opened this issue 5 years ago • 3 comments

cc  -ffunction-sections -fdata-sections -fPIC -I dynasm -I src/machine/asm-Wextra -Wall -c src/machine/asm/execute.S

cannot compile due it's x86 assembly full error log: https://gist.github.com/razum2um/f8ab8d708dc6962d960c6767043c64e7

Environment cpu: rockchip-3399, debian: 10, linux: 5.6.5, gcc: 8.3.0

Is there any earlier portable c/rust version of that? Or any plans to make it portable?

razum2um avatar May 01 '20 11:05 razum2um

For the moment there is no ARM support since the core of CKB VM is built with handcrafted x86_64 assembly code. There is plan to port it to other architecture such as aarch 64 but unfortunately there's no timeline on that now.

xxuejie avatar May 01 '20 11:05 xxuejie

@xxuejie thanks for such a quick reply. yeah, I already examined that file 🙂 I'm just interested in how things work and definitely like the idea of mix riskv and rust. Can you elaborate in some more questions?

  1. What's your estimate of time and complexity of development this vm portion in C?
  2. Does it make sense and will it be viable at all?
  3. What could be initial steps to do that?
  4. What were the reasons to write this in assembly from scratch?

razum2um avatar May 01 '20 12:05 razum2um

I think there's some confusion here: there will never be a pure C version of the VM, it's either a pure Rust version, or a pure assembly version. A pure C version is never guaranteed to be faster than the Rust version, nor will it be as fast as the assembly version.

There is already a pure Rust implementation of the VM here, it is working now can and can be compiled to aarch64 easily. But it will never be used in CKB's production code due to the following reasons:

  • It is almost an order of magnitude slower than the hand-written assembly version
  • Maintaining compatibility between the pure assembly version and Rust version takes too much effort and not much gains

So I would say this really depends on your use case: if you just want to play with CKB VM on aarch64, you can do it now via the Rust implementation; but if your goal is to run the full CKB node on aarch64, a native aarch64 port of the assembly code will be required.

xxuejie avatar May 03 '20 02:05 xxuejie