Skip to content

Commit 52164c4

Browse files
committed
Merge remote-tracking branch 'origin/main' into flash_attention
2 parents 226d0cd + de0376f commit 52164c4

File tree

86 files changed

+5555
-1226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+5555
-1226
lines changed

.github/dockerfiles/env/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ RUN echo "conda prefix after installing jupyterhub: $(du --human-readable --summ
7474
# install infractl, lit
7575
RUN set -e; \
7676
. ${CONDA_PREFIX}/etc/profile.d/conda.sh; \
77-
conda create --name python-3.9 python=3.9 ipykernel s3cmd dvc; \
77+
conda create --name python-3.9 python=3.9 ipykernel s3cmd dvc numpy; \
7878
conda activate python-3.9; \
7979
pip --no-cache-dir install infractl lit
8080

.github/dockerfiles/env/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
REGISTRY=localhost:5000
4-
TAG=graph-compiler-env:0.0.11
4+
TAG=graph-compiler-env:0.0.13
55

66
set -e
77

.github/dockerfiles/env/entrypoint.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,4 @@ jupyter kernelspec remove -y python3 || true
5858
# Remove lost+found
5959
rm -rf lost+found
6060

61-
find ~/.conda -name '*singleuser'
62-
6361
exec jupyterhub-singleuser

.github/dockerfiles/runner/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ RUN set -ex; \
1010
curl -sSL https://cli.github.com/packages/githubcli-archive-keyring.gpg > /usr/share/keyrings/githubcli-archive-keyring.gpg; \
1111
apt-get update -y; \
1212
apt-get install -y --no-install-recommends --fix-missing \
13-
python3-pip \
13+
python3-pip python3-dev \
1414
cmake gcc g++ ninja-build git clang-format \
1515
gh \
16+
libomp-dev \
1617
; \
1718
rm -rf /var/lib/apt/lists/*
1819

19-
RUN pip install lit
20+
RUN pip install lit numpy
2021

2122
USER runner
2223
WORKDIR $HOME

.github/dockerfiles/runner/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
REGISTRY=localhost:5000
4-
TAG=graph-compiler-runner:latest
4+
TAG=graph-compiler-runner:0.0.2
55

66
kubectl -n docker-registry port-forward svc/docker-registry 5000:5000 &
77

.github/workflows/build-llvm.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: LLVM Build
22

33
on:
44
workflow_dispatch:
5+
push:
6+
paths:
7+
- cmake/llvm-version.txt
8+
- .github/workflows/build-llvm.yml
59

610
permissions: read-all
711

@@ -24,9 +28,10 @@ jobs:
2428

2529
- name: Build
2630
run: |
31+
python3 -m pip install -r mlir/python/requirements.txt
2732
mkdir llvm-install
28-
cmake -G Ninja llvm -B build -DCMAKE_INSTALL_PREFIX=llvm-install \
29-
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=true -DLLVM_ENABLE_PROJECTS="mlir" -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_INSTALL_UTILS=true -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DLLVM_INSTALL_GTEST=ON
33+
cmake -G Ninja llvm -B build -DCMAKE_INSTALL_PREFIX=llvm-install -DMLIR_ENABLE_BINDINGS_PYTHON=ON -DPython3_EXECUTABLE=$(which python3) \
34+
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=true -DLLVM_ENABLE_PROJECTS="mlir" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="SPIRV" -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_INSTALL_UTILS=true -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DLLVM_INSTALL_GTEST=ON
3035
cmake --build build --target install
3136
cd llvm-install
3237
tar -zcf ../llvm.tgz .

.github/workflows/build.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Graph Compiler build
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- main
@@ -21,6 +22,22 @@ jobs:
2122
steps:
2223
- uses: actions/checkout@v4
2324

25+
- name: Set LLVM hash
26+
run: |
27+
echo LLVM_HASH=$(cat cmake/llvm-version.txt) >>$GITHUB_ENV
28+
29+
- name: Fetch requirements for python binding
30+
uses: actions/checkout@v4
31+
with:
32+
repository: llvm/llvm-project
33+
ref: ${{ env.LLVM_HASH }}
34+
sparse-checkout: mlir/python/requirements.txt
35+
sparse-checkout-cone-mode: false
36+
path: llvm-dep
37+
38+
- name: Install requirements
39+
run: python3 -m pip install -r llvm-dep/mlir/python/requirements.txt
40+
2441
- name: Build
2542
run: |
2643
scripts/compile.sh

.github/workflows/clang-tidy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- name: Get changed files
6363
run: |
6464
cd graph-compiler
65-
echo "CHANGED_FILES=$(git diff --name-only $MERGE_BASE ${{ github.event.pull_request.head.sha }} | paste -sd' ')" >> $GITHUB_ENV
65+
echo "CHANGED_FILES=$(git diff --name-only --diff-filter=d $MERGE_BASE ${{ github.event.pull_request.head.sha }} | paste -sd' ')" >> $GITHUB_ENV
6666
6767
- name: Prepare Environment
6868
shell: bash
@@ -102,4 +102,4 @@ jobs:
102102
shell: bash
103103
run: |
104104
cd build
105-
python3 ../llvm-project/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -warnings-as-errors=* -p ./ -config-file ../llvm-project/mlir/.clang-tidy -clang-tidy-binary $(which clang-tidy) ${{ env.CHANGED_FILES }}
105+
python3 ../llvm-project/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -warnings-as-errors=* -p ./ -config-file ../llvm-project/mlir/.clang-tidy -clang-tidy-binary $(which clang-tidy-15) ${{ env.CHANGED_FILES }}

.github/workflows/license.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
2727
- name: Get changed files
2828
run: |
29-
echo "CHANGED_FILES=`git diff --name-only $MERGE_BASE ${{ github.event.pull_request.head.sha }} | paste -sd,`" >> $GITHUB_ENV
29+
echo "CHANGED_FILES=`git diff --name-only --diff-filter=d $MERGE_BASE ${{ github.event.pull_request.head.sha }} | paste -sd,`" >> $GITHUB_ENV
3030
3131
- name: Perform license check
3232
run: "python scripts/license.py --files $CHANGED_FILES"

CMakeLists.txt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ project(GraphCompiler VERSION "0.1.0" LANGUAGES C CXX)
2020

2121
set(CMAKE_CXX_STANDARD 17)
2222
set(CMAKE_CXX_STANDARD_REQUIRED ON)
23+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
2324

2425
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
2526

2627
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
2728

2829
option(GC_LEGACY_ENABLE ON)
2930
option(GC_TEST_ENABLE "Build the tests" ON)
31+
option(GC_USE_GPU "Enable GPU backend" OFF)
3032
option(GC_ENABLE_BINDINGS_PYTHON "Enable Graph Complier Python Binding" ON)
3133
option(GC_DEV_LINK_LLVM_DYLIB "Link dynamic libraries of LLVM and MLIR. For developers only. Do not use it in packing the library." OFF)
3234

@@ -51,6 +53,13 @@ include(AddLLVM)
5153
include(AddMLIR)
5254
include(HandleLLVMOptions)
5355

56+
if(GC_USE_GPU)
57+
include(imex)
58+
if(GC_DEV_LINK_LLVM_DYLIB)
59+
message(WARN "GPU backend may not be compatible with dynamic linking to LLVM")
60+
endif()
61+
endif()
62+
5463
if(GC_ENABLE_BINDINGS_PYTHON AND NOT MLIR_ENABLE_BINDINGS_PYTHON)
5564
message(STATUS "Failed to enable Python API due to the 'MLIR_ENABLE_BINDINGS_PYTHON' for LLVM is not ON.")
5665
set(GC_ENABLE_BINDINGS_PYTHON OFF CACHE BOOL "" FORCE)
@@ -95,13 +104,12 @@ if(GC_ENABLE_BINDINGS_PYTHON)
95104
endif()
96105

97106
set(GC_LIB_LINKED_LIBS
98-
GCPasses
99-
GCAnalysis
100-
MLIROneDNNGraph
107+
GCJitWrapper
108+
GCCpuRuntime
101109
)
102-
add_library(graph_compiler SHARED ${GC_LIB_SOURCES})
110+
add_mlir_library(graph_compiler SHARED ${GC_LIB_SOURCES})
103111
target_include_directories(graph_compiler PUBLIC ${GC_LIB_INCLUDES})
104-
target_compile_options(graph_compiler PRIVATE -fvisibility=hidden)
112+
target_compile_options(graph_compiler PRIVATE -fvisibility=hidden -fexceptions)
105113
target_link_options(graph_compiler PRIVATE -Wl,--gc-sections)
106114
target_link_libraries(graph_compiler PRIVATE ${GC_LIB_LINKED_LIBS})
107115

0 commit comments

Comments
 (0)