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

feat: Add new AOT mode to replace experimental JIT mode #72

Merged
merged 8 commits into from
Jun 20, 2019

Conversation

xxuejie
Copy link
Collaborator

@xxuejie xxuejie commented Jun 13, 2019

This PR adds a new AOT mode evolved from previously experimental JIT mode. It works by compiling a RISC-V program directly into x64 assemblies. After that, most of the code can just run in the compiled x64 assembly binary without any overhead.

Benchmark shows that this can further bump VM performance from 6ms measured in assembly interpreter to ~1.5ms(of which ~0.9ms is the actual running time).

With this new AOT mode, we are also removing our old JIT mode which serves its purpose.

@nervos-bot

This comment has been minimized.

@xxuejie xxuejie marked this pull request as ready for review June 13, 2019 10:25
@xxuejie xxuejie requested review from a team June 13, 2019 10:25
@codecov

This comment has been minimized.

Copy link
Member

@doitian doitian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review for LabelGatheringMachine

src/machine/aot/mod.rs Outdated Show resolved Hide resolved
src/machine/aot/mod.rs Outdated Show resolved Hide resolved
src/machine/aot/mod.rs Outdated Show resolved Hide resolved
src/machine/aot/mod.rs Outdated Show resolved Hide resolved
src/machine/aot/mod.rs Outdated Show resolved Hide resolved
src/machine/aot/mod.rs Show resolved Hide resolved
src/machine/aot/aot.x64.c Outdated Show resolved Hide resolved
@doitian
Copy link
Member

doitian commented Jun 19, 2019

  • Review LabelGatheringMachine
  • Review AotCompilingMachine
  • Review instructions in aot.x64.c
    • Value::Op1
    • Value::Op2
    • Value::SignOp2
    • Value::Cond
    • Value::Load

Copy link
Member

@doitian doitian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed Compiling Machine Framework

src/machine/aot/mod.rs Show resolved Hide resolved
src/machine/aot/aot.x64.c Show resolved Hide resolved
src/machine/aot/aot.x64.c Show resolved Hide resolved
src/machine/aot/aot.x64.c Show resolved Hide resolved
src/machine/aot/mod.rs Outdated Show resolved Hide resolved
src/machine/aot/mod.rs Show resolved Hide resolved
src/machine/aot/mod.rs Show resolved Hide resolved
src/machine/aot/mod.rs Show resolved Hide resolved
src/machine/aot/mod.rs Show resolved Hide resolved
src/machine/aot/emitter.rs Show resolved Hide resolved
src/machine/aot/emitter.rs Show resolved Hide resolved
src/machine/aot/emitter.rs Outdated Show resolved Hide resolved
Copy link
Member

@doitian doitian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reviewed the compilation framework and the most op compilation functions. However, I'm not familiar with X86 and RISC-V instruction set, it is hard for me to verify all the ops are compiled into correct X86 ASM. I think we should run the AOT'd code against RISC-V test suites, is this already set up?

) -> c_int;
fn aot_and(c: *mut AotContext, target: u32, a: AotValue, b: AotValue) -> c_int;
fn aot_or(c: *mut AotContext, target: u32, a: AotValue, b: AotValue) -> c_int;
fn aot_not(c: *mut AotContext, target: u32, a: AotValue, is_signed: c_int) -> c_int;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fn aot_not(c: *mut AotContext, target: u32, a: AotValue, is_signed: c_int) -> c_int;
fn aot_not(c: *mut AotContext, target: u32, a: AotValue, logical: c_int) -> c_int;

@xxuejie
Copy link
Collaborator Author

xxuejie commented Jun 20, 2019

I think we should run the AOT'd code against RISC-V test suites, is this already set up?

Yes I've actually written the test suite code out and have it all passed locally, but I haven't pushed it to the test suite repo since as soon as I pushed it, it would invalidate all other PRs in this repo. So the idea is once we merge this PR, I will add the missing test suite related code, then we should be all good. Thoughts?

@doitian
Copy link
Member

doitian commented Jun 20, 2019

I think we should run the AOT'd code against RISC-V test suites, is this already set up?

Yes I've actually written the test suite code out and have it all passed locally, but I haven't pushed it to the test suite repo since as soon as I pushed it, it would invalidate all other PRs in this repo. So the idea is once we merge this PR, I will add the missing test suite related code, then we should be all good. Thoughts?

lgtm

@xxuejie xxuejie merged commit 5ba31b9 into nervosnetwork:develop Jun 20, 2019
@xxuejie xxuejie deleted the aot branch June 20, 2019 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants