-
Notifications
You must be signed in to change notification settings - Fork 16
[P0] Verify the clang++ version used in the test #18 #19
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
base: main
Are you sure you want to change the base?
Changes from 15 commits
85125f1
8b3dfd9
09b8363
98044c2
7b872b6
8a4e8b5
b4ab42a
e4e18e1
9e43f7b
2bb49ff
5e0e577
24b88ce
fd95c0e
61949a5
db3a1af
accef66
6d3dd27
b934374
389e3d1
6b56c40
2f06d19
6da365e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| FROM ubuntu:22.04 | ||
|
|
||
| SHELL ["/bin/bash", "-c"] | ||
|
|
||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| RUN apt-get update \ | ||
| && apt install software-properties-common -y \ | ||
| && add-apt-repository ppa:deadsnakes/ppa -y \ | ||
| && apt update \ | ||
| && apt install python3.12 -y \ | ||
| && apt-get install ninja-build -y \ | ||
| && apt-get install ccache -y \ | ||
| && apt-get install lld -y \ | ||
| && apt-get -y install cmake -y \ | ||
| && apt-get install -y clang \ | ||
| && apt-get -y install git \ | ||
| && mkdir /cgra \ | ||
| && cd /cgra \ | ||
| && git clone https://github.com/yuqisun/dataflow.git \ | ||
| && cd dataflow \ | ||
| && until git clone --depth 1 --branch release/19.x https://github.com/llvm/llvm-project.git; do sleep 5; done \ | ||
| && cd llvm-project \ | ||
| && mkdir build && cd build \ | ||
| && cmake -G Ninja ../llvm \ | ||
| -DLLVM_ENABLE_PROJECTS="mlir" \ | ||
| -DLLVM_BUILD_EXAMPLES=OFF \ | ||
| -DLLVM_TARGETS_TO_BUILD="Native" \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DLLVM_ENABLE_ASSERTIONS=ON \ | ||
| -DCMAKE_C_COMPILER=clang \ | ||
| -DCMAKE_CXX_COMPILER=clang++ \ | ||
| -DCMAKE_CXX_STANDARD=17 \ | ||
| -DCMAKE_CXX_FLAGS="-std=c++17 -frtti" \ | ||
| -DLLVM_ENABLE_LLD=ON \ | ||
| -DMLIR_INSTALL_AGGREGATE_OBJECTS=ON \ | ||
| -DLLVM_ENABLE_RTTI=ON \ | ||
| -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ | ||
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | ||
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | ||
| && cmake --build . --target check-mlir \ | ||
| && dpkg -l | grep llvm \ | ||
| && cd /cgra/dataflow \ | ||
| && mkdir build && cd build \ | ||
| && cmake -G Ninja .. \ | ||
| -DLLVM_DIR=/cgra/dataflow/llvm-project/build/lib/cmake/llvm \ | ||
| -DMLIR_DIR=/cgra/dataflow/llvm-project/build/lib/cmake/mlir \ | ||
| -DMLIR_SOURCE_DIR=/cgra/dataflow/llvm-project/mlir \ | ||
| -DMLIR_BINARY_DIR=/cgra/dataflow/llvm-project/build \ | ||
| -DCMAKE_CXX_FLAGS="-std=c++17" \ | ||
| && ninja \ | ||
| && cd /cgra/dataflow/test \ | ||
| && /cgra/dataflow/llvm-project/build/bin/llvm-lit * -v | ||
|
|
||
| CMD ["tail", "-f", "/dev/null"] | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,13 +34,16 @@ jobs: | |
| sudo apt-get install ccache | ||
| sudo apt-get install lld | ||
|
|
||
| # install clang for LLVM build | ||
| - name: install clang | ||
| run: sudo apt-get install -y clang | ||
|
||
|
|
||
| # setup LLVM | ||
| - name: install a specific version of LLVM | ||
| working-directory: ${{github.workspace}} | ||
| run: | | ||
| git clone https://github.com/llvm/llvm-project.git | ||
| git clone --depth 1 --branch release/19.x https://github.com/llvm/llvm-project.git | ||
tancheng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| cd llvm-project | ||
| git checkout cd70802 | ||
| mkdir build && cd build | ||
| cmake -G Ninja ../llvm \ | ||
| -DLLVM_ENABLE_PROJECTS="mlir" \ | ||
|
|
@@ -55,10 +58,15 @@ jobs: | |
| -DLLVM_ENABLE_LLD=ON \ | ||
| -DMLIR_INSTALL_AGGREGATE_OBJECTS=ON \ | ||
| -DLLVM_ENABLE_RTTI=ON \ | ||
| -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ | ||
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | ||
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | ||
|
|
||
| cmake --build . --target check-mlir | ||
| dpkg -l | grep llvm | ||
| sudo apt-get purge llvm-13 | ||
| sudo apt-get purge llvm-14 | ||
| sudo apt-get purge llvm-15 | ||
tancheng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # setup mlir-cgra | ||
| - name: setup dataflow tool-chain | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also mention we prefer the clang is also in llvm-19 version? I am wondering, when we build LLVM-19.x from source, it is compiled using the built-in clang, which may not be llvm-19, right? Then if user install clang in llvm-19, should we update this https://github.com/coredac/dataflow/blob/ff914bc44d0c2cb5589ca962ff32cbe372ea9871/test/c2llvm2mlir/test.mlir#L5 to distinguish the system clang and the user-installed clang?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about now: Compile both clang and mlir and add note at the beginning of test.mlir to recommend user to add llvm-19 clang to PATH.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,14 +2,13 @@ | |
|
|
||
| Build LLVM & Neura | ||
| -------------------------------------------------------- | ||
| - Clone llvm-project. | ||
|
|
||
| - Clone this repo. | ||
|
|
||
| - Clone llvm-project (we prefer llvm-19). | ||
| ```sh | ||
| $ git clone --depth 1 --branch release/19.x https://github.com/llvm/llvm-project.git | ||
| ``` | ||
| - Build LLVM: | ||
| - Check out to commit `cd70802` (a stable version randomly picked, will sync to the latest version). | ||
| - Build: | ||
| ```sh | ||
| $ cd llvm-project | ||
| $ mkdir build && cd build | ||
| # May need install ccache and lld. | ||
| $ cmake -G Ninja ../llvm \ | ||
|
|
@@ -25,6 +24,7 @@ Build LLVM & Neura | |
| -DLLVM_ENABLE_LLD=ON \ | ||
| -DMLIR_INSTALL_AGGREGATE_OBJECTS=ON \ | ||
| -DLLVM_ENABLE_RTTI=ON \ | ||
| -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is for?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added this because Ninja cannot auto fix RPATH:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's also have
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added. |
||
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | ||
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | ||
| $ cmake --build . --target check-mlir | ||
|
|
@@ -54,3 +54,16 @@ Build LLVM & Neura | |
| $ /workspace/llvm-project/build/bin/llvm-lit * | ||
| ``` | ||
|
|
||
tancheng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Docker-based Environment Setup | ||
| -------------------------------------------------------- | ||
| You can quickly set up the build and test environment using the provided Dockerfile: | ||
|
|
||
| ```sh | ||
| # In the root directory of this repo: | ||
| $ cd docker | ||
| $ docker build -t neura:v1 . | ||
| $ docker run --name myneura -it neura:v1 | ||
| ``` | ||
|
|
||
| This will automatically clone, build, and test LLVM/MLIR and Neura inside a container, ensuring a consistent environment. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.