Skip to content

Commit 3ea41dd

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix-linalg-to-xe
2 parents 716af02 + 0d1d9c6 commit 3ea41dd

File tree

11 files changed

+512
-13
lines changed

11 files changed

+512
-13
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,15 @@ cmake --build . --target gc-check
5858
Notes:
5959
* `/PATH/TO/llvm-project/llvm-install` should be the install path of LLVM. If you installed LLVM elsewhere by `-DCMAKE_INSTALL_PREFIX` option when building LLVM, you need to change the path in `-DMLIR_DIR` accordingly.
6060
* The cmake option `-DLLVM_EXTERNAL_LIT` is for the tests of this project. It requires the `lit` tool to be installed in the system. You can install it via `pip install lit`. If you don't need to run the tests of this repo, you can omit this option in the command line.
61-
* If GPU components are on (`-DGC_USE_GPU=ON`), make sure the Level-zero runtime is installed in your system. Either install Level-zero runtime via system package managers (e.g. `apt`), or follow the instructions of [IMEX](https://github.com/intel/mlir-extensions).
61+
62+
More notes if GPU components are on (`-DGC_USE_GPU=ON`):
63+
* make sure the OpenCL runtime is installed in your system. You can either
64+
install using OS-provided package (Ubuntu 22.04)
65+
```sh
66+
sudo apt install -y intel-opencl-icd opencl-c-headers
67+
```
68+
Or, download and install package from: https://github.com/intel/compute-runtime/releases
69+
* the LLVM codebase needs to be patched to support XeGPU lowering (from IMEX). Please follow instructions of [IMEX](https://github.com/intel/mlir-extensions) on patching LLVM.
6270

6371
Graph Compiler supports the following build-time options.
6472

cmake/imex.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ get_property(IMEX_INCLUDES GLOBAL PROPERTY IMEX_INCLUDES)
44
if (NOT DEFINED IMEX_INCLUDES)
55
include(functions)
66
set(IMEX_CHECK_LLVM_VERSION ON)
7-
set(IMEX_ENABLE_L0_RUNTIME 1)
7+
set(IMEX_ENABLE_L0_RUNTIME 0)
88
# TODO: Change to main https://github.com/oneapi-src/oneDNN.git when all the
99
# required functionality is merged.
1010
gc_fetch_content(imex 496b240093b5e132b60c5ee69878300fe69be300 https://github.com/Menooker/mlir-extensions
11-
CMAKE_ARGS "-DMLIR_DIR=${MLIR_DIR};-DIMEX_CHECK_LLVM_VERSION=ON;-DIMEX_ENABLE_L0_RUNTIME=1"
11+
CMAKE_ARGS "-DMLIR_DIR=${MLIR_DIR};-DIMEX_CHECK_LLVM_VERSION=ON;-DIMEX_ENABLE_L0_RUNTIME=0"
1212
)
1313

1414
set(IMEX_INCLUDES

include/gc/Transforms/Passes.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ def LinalgToXeGPU : Pass<"linalg-to-xegpu", "func::FuncOp"> {
5757
"DPAS register block sizes MxNxK">,
5858
];
5959
}
60-
#endif // GC_USE_GPU
60+
#endif
6161

6262
#endif // GC_DIALECT_GC_PASSES

lib/gc/ExecutionEngine/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
add_subdirectory(CPURuntime)
2-
add_subdirectory(Driver)
2+
add_subdirectory(Driver)
3+
if(GC_USE_GPU)
4+
add_subdirectory(OpenCLRuntime)
5+
endif()
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
find_package(OpenCL REQUIRED)
2+
3+
add_mlir_library(mlir_opencl_runtime
4+
SHARED
5+
OpenCLRuntimeWrappers.cpp
6+
7+
EXCLUDE_FROM_LIBMLIR
8+
)
9+
10+
check_cxx_compiler_flag("-frtti" CXX_HAS_FRTTI_FLAG)
11+
if(NOT CXX_HAS_FRTTI_FLAG)
12+
message(FATAL_ERROR "CXX compiler does not accept flag -frtti")
13+
endif()
14+
target_compile_options (mlir_opencl_runtime PUBLIC -fexceptions -frtti)
15+
16+
target_include_directories(mlir_opencl_runtime PRIVATE
17+
${MLIR_INCLUDE_DIRS}
18+
${OpenCL_INCLUDE_DIRS}
19+
)
20+
21+
message(STATUS "OpenCL Libraries: ${OpenCL_LIBRARIES}")
22+
target_link_libraries(mlir_opencl_runtime PUBLIC ${OpenCL_LIBRARIES})

0 commit comments

Comments
 (0)