-
Notifications
You must be signed in to change notification settings - Fork 14
[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 all 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
|
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 dataflow/test/c2llvm2mlir/test.mlir Line 5 in ff914bc
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,18 +2,21 @@ | |
|
|
||
| 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: | ||
| > **Note:** | ||
| > `clang` is optional for building Neura itself, but installing and building `clang` together with `mlir` (by setting `-DLLVM_ENABLE_PROJECTS="clang;mlir"`) ensures that you have a `clang`/`clang++` matching the same LLVM/MLIR version (19). | ||
| > This is recommended if you want to use `clang++` for C++ to LLVM IR/MLIR workflows and to avoid version mismatch issues. | ||
|
|
||
| ```sh | ||
| $ cd llvm-project | ||
| $ mkdir build && cd build | ||
| # May need install ccache and lld. | ||
| $ cmake -G Ninja ../llvm \ | ||
| -DLLVM_ENABLE_PROJECTS="mlir" \ | ||
| -DLLVM_ENABLE_PROJECTS="clang;mlir" \ | ||
| -DLLVM_BUILD_EXAMPLES=OFF \ | ||
| -DLLVM_TARGETS_TO_BUILD="Native" \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
|
|
@@ -25,9 +28,14 @@ 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_EXPORT_COMPILE_COMMANDS=ON \ | ||
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | ||
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | ||
| $ cmake --build . --target check-mlir | ||
| $ ninja | ||
| $ ninja check-clang check-mlir | ||
| $ export PATH=/workspace/llvm-project/build/bin:$PATH | ||
| ``` | ||
|
|
||
| - Build Neura: | ||
|
|
@@ -54,3 +62,24 @@ Build LLVM & Neura | |
| $ /workspace/llvm-project/build/bin/llvm-lit * | ||
| ``` | ||
|
|
||
tancheng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Docker-based Environment Setup | ||
| -------------------------------------------------------- | ||
| **Option 1: Pull Pre-built Image** | ||
|
|
||
| You can directly pull and use the pre-built Docker image: | ||
| ```sh | ||
| $ docker pull cgra/neura:v1 | ||
|
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. Image is pushing in progress:
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. Uploaded to cgra/neura:v1. |
||
| $ docker run --name myneura -it cgra/neura:v1 | ||
| ``` | ||
|
|
||
| **Option 2: Build Image from Dockerfile** | ||
|
|
||
| Alternatively, you can build the Docker image yourself 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 | ||
| ``` | ||
|
|
||
| Both methods will provide a consistent environment with LLVM/MLIR(version 19) and Neura built and ready to use. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| 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 install -y clang \ | ||
| && apt-get -y install build-essential cmake git libxml2-dev zlib1g-dev libncurses5-dev \ | ||
| && 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="clang;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_EXPORT_COMPILE_COMMANDS=ON \ | ||
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | ||
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | ||
| # && cmake --build . --target check-mlir \ | ||
| && ninja \ | ||
| && ninja check-clang 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 | ||
|
|
||
| ENV PATH=/cgra/dataflow/llvm-project/build/bin:$PATH | ||
|
|
||
| CMD ["tail", "-f", "/dev/null"] | ||
|
|
||
|
|
Uh oh!
There was an error while loading. Please reload this page.