Skip to content

Commit a77fb6d

Browse files
committed
merge main
2 parents 3c72835 + 3934bc8 commit a77fb6d

File tree

86 files changed

+9293
-406
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

+9293
-406
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Graph Compiler build
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
11+
12+
permissions: read-all
13+
14+
jobs:
15+
build:
16+
name: Build GPU with IMEX
17+
runs-on: [self-hosted, l0]
18+
19+
env:
20+
GH_TOKEN: ${{ github.token }}
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set LLVM hash
26+
run: |
27+
echo LLVM_HASH=$(cat cmake/llvm-version-imex.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+
41+
- name: Build
42+
run: |
43+
scripts/compile.sh --imex
44+
45+
- name: Test
46+
run: |
47+
cmake --build build --target gc-check

.github/workflows/build-llvm.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,41 @@ jobs:
1313
build:
1414
name: Build
1515
runs-on: [self-hosted]
16+
strategy:
17+
matrix:
18+
build-type: [CPU, IMEX]
1619

1720
steps:
1821
- uses: actions/checkout@v4
1922

2023
- name: Set LLVM hash
2124
run: |
22-
echo LLVM_HASH=$(cat cmake/llvm-version.txt) >>$GITHUB_ENV
25+
if [ "${{ matrix.build-type }}" = "IMEX" ]; then
26+
echo LLVM_HASH=$(cat cmake/llvm-version-imex.txt) >>$GITHUB_ENV
27+
echo IMEX_HASH=$(cat cmake/imex-version.txt) >>$GITHUB_ENV
28+
else
29+
echo LLVM_HASH=$(cat cmake/llvm-version.txt) >>$GITHUB_ENV
30+
fi
31+
32+
- uses: actions/checkout@v4
33+
with:
34+
repository: Menooker/mlir-extensions
35+
ref: ${{ env.IMEX_HASH }}
36+
path: mlir-extensions
37+
if: ${{ matrix.build-type == 'IMEX' }}
2338

2439
- uses: actions/checkout@v4
2540
with:
2641
repository: llvm/llvm-project
2742
ref: ${{ env.LLVM_HASH }}
43+
path: llvm-project
2844

2945
- name: Build
3046
run: |
47+
cd llvm-project
48+
if [ "${{ matrix.build-type }}" = "IMEX" ]; then
49+
git apply ../mlir-extensions/build_tools/patches/*
50+
fi
3151
python3 -m pip install -r mlir/python/requirements.txt
3252
mkdir llvm-install
3353
cmake -G Ninja llvm -B build -DCMAKE_INSTALL_PREFIX=llvm-install -DMLIR_ENABLE_BINDINGS_PYTHON=ON -DPython3_EXECUTABLE=$(which python3) \
@@ -36,9 +56,18 @@ jobs:
3656
cd llvm-install
3757
tar -zcf ../llvm.tgz .
3858
39-
- uses: actions/upload-artifact@v4
59+
- name: Upload LLVM for CPU
60+
if: matrix.build-type == 'CPU'
61+
uses: actions/upload-artifact@v4
4062
with:
4163
name: llvm-${{ env.LLVM_HASH }}
42-
path: llvm.tgz
64+
path: ./llvm-project/llvm.tgz
65+
66+
- name: Upload LLVM for IMEX
67+
if: matrix.build-type == 'IMEX'
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: llvm-${{ env.LLVM_HASH }}-imex-patched
71+
path: ./llvm-project/llvm.tgz
4372

4473

.github/workflows/clang-tidy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ jobs:
8181
-DCMAKE_EXPORT_COMPILE_COMMANDS=True \
8282
-DCMAKE_C_COMPILER=$(which clang) \
8383
-DCMAKE_CXX_COMPILER=$(which clang++) \
84-
-DLLVM_EXTERNAL_LIT=$(which lit)
84+
-DLLVM_EXTERNAL_LIT=$(which lit) \
85+
-DDNNL_USE_CLANG_SANITIZER="Undefined"
8586
8687
- name: Prepare inc file
8788
run: |

CMakeLists.txt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,41 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
2929
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85827 for details. The issue is
3030
# fixed in GCC 10.
3131
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.0")
32+
include(CheckCXXCompilerFlag)
3233
check_cxx_compiler_flag("-Wno-unused-but-set-parameter" CXX_SUPPORTS_WNO_UNUSED_BUT_SET_PARAMETER)
33-
append_if(CXX_SUPPORTS_WNO_UNUSED_BUT_SET_PARAMETER "-Wno-unused-but-set-parameter" CMAKE_CXX_FLAGS)
34+
if(CXX_SUPPORTS_WNO_UNUSED_BUT_SET_PARAMETER)
35+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-parameter")
36+
endif()
3437
endif()
3538
################################################################################
3639

3740
############################ Build options #####################################
3841
option(GC_ENABLE_LEGACY ON)
39-
option(GC_ENABLE_DNNL "Enable the oneDNN library integration" ON)
42+
option(GC_ENABLE_DNNL_API "Enable the oneDNN library API integration" ON)
4043
option(GC_ENABLE_TEST "Build the tests" ON)
41-
option(GC_ENABLE_TEST_DNNL "Build the dnnl tests" ${GC_ENABLE_DNNL})
44+
option(GC_ENABLE_TEST_DNNL_API "Build the dnnl tests" ${GC_ENABLE_DNNL_API})
4245
option(GC_ENABLE_TEST_MLIR "Build the mlir tests" ON)
4346
option(GC_ENABLE_TOOLS "Build the tools" ON)
4447
option(GC_ENABLE_OPT "Build gc-opt" ${GC_ENABLE_TOOLS})
4548
option(GC_ENABLE_IMEX "Enable Intel® Extension for MLIR" OFF)
4649
option(GC_ENABLE_BINDINGS_PYTHON "Enable Graph Complier Python Binding" ON)
4750
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)
51+
option(GC_ENABLE_RUNTIME_NAIVE_BRGEMM "Use naive BRGEMM as runtime backend for debug purpose." OFF)
4852

4953
if(GC_ENABLE_LEGACY)
5054
add_subdirectory(legacy/core)
5155
endif()
5256

53-
if(GC_ENABLE_DNNL)
57+
58+
if (GC_ENABLE_IMEX)
59+
# normalize the value for lit config
60+
set(GC_ENABLE_IMEX ON)
61+
endif()
62+
63+
if(GC_ENABLE_DNNL_API)
5464
set(GC_ONEDNN_DIALECT_LIB_NAME MLIROneDNNGraph)
65+
# normalize the value for lit config
66+
set(GC_ENABLE_DNNL_API ON)
5567
endif()
5668
################################################################################
5769

cmake/imex-version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
d5bbd635dee500b8cff138686833bacfac5ade78

cmake/imex.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@ if (NOT DEFINED IMEX_INCLUDES)
66
message(WARN "GPU backend may not be compatible with dynamic linking to LLVM")
77
endif()
88

9+
# Read the content of imex-version.txt
10+
file(READ "${CMAKE_CURRENT_LIST_DIR}/imex-version.txt" IMEX_HASH)
11+
12+
# Strip any extra whitespace or newlines
13+
string(STRIP "${IMEX_HASH}" IMEX_HASH)
14+
915
# TODO: Change to main https://github.com/intel/mlir-extensions when all the
1016
# required functionality is merged.
11-
gc_fetch_content(imex 496b240093b5e132b60c5ee69878300fe69be300 https://github.com/Menooker/mlir-extensions
17+
gc_fetch_content(imex "${IMEX_HASH}" https://github.com/Menooker/mlir-extensions
1218
SET IMEX_CHECK_LLVM_VERSION=ON IMEX_ENABLE_L0_RUNTIME=0
1319
)
1420

cmake/llvm-version-imex.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
89946bda5e1c7ceaf6d26634cc8c8c9498d9f7be

cmake/llvm-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
89946bda5e1c7ceaf6d26634cc8c8c9498d9f7be
1+
8345289ded788f4df79f59df76df0c0437c3df64

cmake/onednn.cmake

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,9 @@ if (NOT DEFINED GC_DNNL_INCLUDES)
1313
$<BUILD_INTERFACE:${dnnl_SOURCE_DIR}/include>
1414
$<BUILD_INTERFACE:${dnnl_SOURCE_DIR}/src>
1515
)
16+
1617
set_property(GLOBAL PROPERTY GC_DNNL_INCLUDES ${GC_DNNL_INCLUDES})
18+
set_property(GLOBAL PROPERTY GC_DNNL_SOURCE_DIR ${dnnl_SOURCE_DIR})
1719

18-
# This allows to generate headers from *.in without adding the library to the build.
19-
# If the build is required, remove this and the SKIP_ADD option above.
20-
if (DEFINED CMAKE_GENERATOR)
21-
set(GENERATOR_FLAG "-G ${CMAKE_GENERATOR}")
22-
endif ()
23-
execute_process(COMMAND ${CMAKE_COMMAND} ${GENERATOR_FLAG}
24-
-Wno-dev
25-
-S ${dnnl_SOURCE_DIR}
26-
-B ${dnnl_BINARY_DIR}
27-
-DDNNL_IS_MAIN_PROJECT=FALSE -DDNNL_BUILD_TESTS=FALSE -DDNNL_BUILD_EXAMPLES=FALSE
28-
COMMAND_ERROR_IS_FATAL ANY
29-
)
20+
include(onednn_lite_config)
3021
endif ()

0 commit comments

Comments
 (0)