-
Notifications
You must be signed in to change notification settings - Fork 16
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
Backend for generating RVSDG using the MLIR dialect #254
Conversation
c96a863
to
12cc9ec
Compare
96d5729
to
c458c2f
Compare
794d86d
to
d69d4f7
Compare
c0c3162
to
9841f30
Compare
When creating an MLIR backend and frontend, we need to be able to specify format for both the input and output. A question is how to handle the naming of these. The current version uses the following, non-optimal, names. Select input format |
945976d
to
8726b15
Compare
76e2513
to
c4d997b
Compare
Initial attempt of creating a backend for jlm-opt that outputs rvsdg as MLIR IR.
The code currently assumes that the MLIR implementation of RVSDG resides in the same root directory as the main jlm directory, i.e.,
/
jlm
mlir-rvsdg
The dialect can be cloned with
git clone [email protected]:Riphiphip/mlir_rvsdg.git mlir-rvsdg
And built by
cd mlir-rvsdg
mkdir build
cd build
cmake -G Ninja ..
-DCMAKE_C_COMPILER=clang-16
-DCMAKE_CXX_COMPILER=clang++-16
-DLLVM_DIR=/usr/lib/llvm-16/cmake/
-DMLIR_DIR=/usr/lib/llvm-16/lib/cmake/mlir
cmake --build .
At this point, it should be possible to build jlm as normal.
The backend currently only supports lambda and arithmetic constants, so the test cases are limited.
Currently, the only code that has been used to test the backend is:
test.c :
int test() {
return 1;
}
The backend can be tested by:
/usr/lib/llvm-16/bin/clang -S -emit-llvm -o test.ll test.c
jlm-opt --mlir --dne test.ll
This should print the following MLIR IR:
rvsdg.omegaNode (): {
%0 = rvsdg.lambdaNode <(!rvsdg.ioState, !rvsdg.memState, !rvsdg.loopState) -> (i32, !rvsdg.ioState, !rvsdg.memState, !rvsdg.loopState)> () : (%arg0: !rvsdg.ioState, %arg1: !rvsdg.memState, %arg2: !rvsdg.loopState): {
%c1_i32 = arith.constant 1 : i32
rvsdg.lambdaResult (%c1_i32: i32, %arg0: !rvsdg.ioState, %arg1: !rvsdg.memState, %arg2: !rvsdg.loopState)
}
rvsdg.omegaResult (%0: !rvsdg.lambdaRef<(!rvsdg.ioState, !rvsdg.memState, !rvsdg.loopState) -> (i32, !rvsdg.ioState, !rvsdg.memState, !rvsdg.loopState)>)
}