eBPF Compatibility #346
Replies: 10 comments 5 replies
-
|
Are we still going to support dynamic stack frames? |
Beta Was this translation helpful? Give feedback.
-
|
We need to allow multiple returns, not only aggregate return types. Also, we would need to check if we can upstream the code generation improvements I did recently. |
Beta Was this translation helpful? Give feedback.
-
|
Some other things are tuned for SBF, like the threshold for memops. We also have our own implementation of compiler builtins to be compatible with static syscalls. |
Beta Was this translation helpful? Give feedback.
-
|
The BPF target also supports JSET: llvm/llvm-project#73161 Although we can make the VM compatible with BPF, we have no control of its design choices and the newer instructions that might be added. We can remain relatively stable for some time, but ultimately we'll need to catch up with the BPF changes. My question is whether it is worth the effort to keep catching up with BPF changes, assuming that will require constant VM updates, program versioning and feature gates? |
Beta Was this translation helpful? Give feedback.
-
|
Also missing: sdiv and smod. |
Beta Was this translation helpful? Give feedback.
-
|
Given that the pressure for less CUs in contracts keeps mounting, since users pay for CUs, I wonder if sticking to the BPF standard won't be a liability for us and hinder our innovation capacity. One of the examples I can give is the number of registers. If we could, for instance, increase the number of registers to 16 (16 is simply to avoid leaving from the BPF ISA standard), we would drastically decrease the CU consumption of contracts. This change is not costly to the validator and easy to implement in the compiler. |
Beta Was this translation helpful? Give feedback.
-
|
eBPF allows jumps with 32 bit offsets: https://github.com/anza-xyz/llvm-project/blob/0c30adaa95a6c007f6210d41735371f25c4c91ed/llvm/lib/Target/BPF/BPFInstrInfo.td#L637-L647 |
Beta Was this translation helpful? Give feedback.
-
|
It looks like eBPF wants to support predicated instructions, like All these changes make me wonder how much our effort is worth into pursuing eBPF compatibility. Clearly, the way eBPF is heading not necessarily benefits us, and pile up our VM backlog just to catch up with them. |
Beta Was this translation helpful? Give feedback.
-
|
eBPF default CPU is v3. The next version v4 also has sign extend loads and sign extend mov: |
Beta Was this translation helpful? Give feedback.
-
Give that we'll need to implement the linker ourselves, I don't think we need to change the file type. That is better for compatibility with tooling. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Based on the discussions on Discord, Slack and the linked SIMDs this is an aggregation of all the things related to the aspiration of the ISA becoming compatible with eBPF.
Bytecode
callxcall target in thedstreg instead of the immediate valuecallandsyscallbysrcreg instead of by opcodesyscallencodes a hash value in the immediate field (SIMD-0178)Assembly
ELF container
e_type = ET_RELe_machine = EM_BPFLinker
Do fat-LTO in bpf-linker: Compile everything to LLVM bincode, then have the linker combine these and lower them further into bytecode
add64 r10, -stack_frame_bytes) in the function preamble (SIMD-0166)Changes required on upstream
Beta Was this translation helpful? Give feedback.
All reactions