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

Write a target abstraction layer #18

Closed
apt1002 opened this issue Dec 13, 2020 · 2 comments
Closed

Write a target abstraction layer #18

apt1002 opened this issue Dec 13, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@apt1002
Copy link
Owner

apt1002 commented Dec 13, 2020

So far, we've been assuming that everything will run on x86_64 and Linux, and it has been quite helpful not to have to spend time thinking about other platforms. However, in the long term we would like Mijit to run on many different CPU architectures and operating systems. What is needed is a target abstraction layer (hereafter TAL).

There is enough code now that we can begin to enumerate the requirements for the TAL. The required planning work is mostly to draw a boundary through the existing code, and to invent new APIs where the boundary does not follow existing module boundaries. The implementation work is then mostly refactoring.

Aggregate

The following existing API elements do not depend strongly on the target, and could form part of the abstraction that is implemented for every platform:

  • buffer::{Buffer::execute}
  • x86_64::{Assembler::patch}
  • lowerer::{ALLOCATABLE_REGISTERS, Lowerer}
  • optimizer::{cost}

Invent

The following APIs are target-specific, and need to be broken up and abstracted:

  • JitInner::{new} - Prologue and epilogue.

Hide

The following APIs are target-specific and need to be hidden behind the abstraction layer:

  • buffer::{Buffer::new}
  • x86_64::{Precision, Register, ALL_REGISTERS, CALLEE_SAVES, CALLER_SAVES, Assembler}

Expose

The following APIs are target-independent, and can be exposed in front of the abstraction layer:

  • x86_64::{Label, debug_word}
  • code::{Precision, Value, TestOp, UnaryOp, BinaryOp, DivisionOp, Width, AliasMask, Action, Machine}
  • optimizer::{Dataflow, Node, Op, Simulation, Pressure, Schedule, moves, codegen, optmimize}
  • jit::{Convention, Specialization, Jit}

Additional work

  • Research best practice for writing, testing and documenting a Rust API that has a different implementation for each target.
@apt1002 apt1002 added the enhancement New feature or request label Dec 13, 2020
@apt1002 apt1002 mentioned this issue Dec 13, 2020
@apt1002
Copy link
Owner Author

apt1002 commented Mar 16, 2021

#23 is a step in this direction.

@apt1002 apt1002 mentioned this issue Apr 7, 2021
@apt1002
Copy link
Owner Author

apt1002 commented Apr 14, 2021

Updated terminology.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant