Skip to content

Commit 4675567

Browse files
author
Diptorup Deb
committed
Rename imex Cmake options.
1 parent 468d64b commit 4675567

File tree

10 files changed

+74
-37
lines changed

10 files changed

+74
-37
lines changed

CMakeLists.txt

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
cmake_minimum_required(VERSION 3.5)
15+
cmake_minimum_required(VERSION 3.15)
1616

1717
project(mlir-extensions)
1818

@@ -38,8 +38,28 @@ if (CMAKE_SYSTEM_NAME STREQUAL Windows)
3838
# add_link_options(-INTEGRITYCHECK) # require signatures of libs, only recommended
3939
endif()
4040
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
41-
add_compile_options(-D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -fno-delete-null-pointer-checks -fstack-protector-strong -fno-strict-overflow -Wall)
42-
add_compile_options(-fstack-clash-protection -fcf-protection=full) # v8.0 and newer
41+
string(CONCAT WARN_FLAGS
42+
"-Wall "
43+
"-Wextra "
44+
"-Winit-self "
45+
"-Wunused-function "
46+
"-Wuninitialized "
47+
"-Wmissing-declarations "
48+
"-fdiagnostics-color=auto "
49+
"-Wno-deprecated-declarations "
50+
)
51+
string(CONCAT SDL_FLAGS
52+
"-D_FORTIFY_SOURCE=2 "
53+
"-Wformat "
54+
"-Wformat-security "
55+
"-Werror=format-security "
56+
"-fno-delete-null-pointer-checks "
57+
"-fstack-protector-strong "
58+
"-fno-strict-overflow "
59+
"-fstack-clash-protection "
60+
"-fcf-protection=full "
61+
)
62+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARN_FLAGS} ${SDL_FLAGS}")
4363
# add_compile_options(-mcet) # v8.0 and newer # unrecognized command line option '-mcet', only recommended
4464
add_link_options(-Wl,-z,noexecstack,-z,relro,-z,now)
4565
endif()
@@ -49,18 +69,34 @@ if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
4969
# add_compile_options(-mcet) # v8.0 and newer # unrecognized command line option '-mcet', only recommended
5070
endif()
5171

52-
option(DPNP_ENABLE "Use DPNP for some math functions" OFF)
53-
option(GPU_ENABLE "Enable GPU codegen" OFF)
54-
option(NUMBA_ENABLE "Enable numba-based python frontend" OFF)
55-
option(TBB_ENABLE "Enable TBB" OFF)
72+
option(IMEX_USE_DPNP
73+
"Use the dpnp Python NumPy-like library for some math functions"
74+
OFF
75+
)
76+
option(IMEX_ENABLE_IGPU_DIALECT
77+
"Enable GPU codegen"
78+
OFF
79+
)
80+
option(IMEX_ENABLE_NUMBA_FE
81+
"Enable numba-based python frontend"
82+
OFF
83+
)
84+
option(IMEX_ENABLE_TBB_SUPPORT
85+
"Enable TBB"
86+
OFF
87+
)
88+
option(IMEX_ENABLE_TESTS
89+
"Enable CTests"
90+
OFF
91+
)
92+
93+
message(STATUS "IMEX_USE_DPNP ${DPNIMEX_USE_DPNPP_ENABLE}")
94+
message(STATUS "IMEX_ENABLE_IGPU_DIALECT ${IMEX_ENABLE_IGPU_DIALECT}")
95+
message(STATUS "IMEX_ENABLE_TESTS ${IMEX_ENABLE_TESTS}")
96+
message(STATUS "IMEX_ENABLE_NUMBA_FE ${IMEX_ENABLE_NUMBA_FE}")
97+
message(STATUS "IMEX_ENABLE_TBB_SUPPORT ${IMEX_ENABLE_TBB_SUPPORT}")
5698

57-
message(STATUS "DPNP_ENABLE ${DPNP_ENABLE}")
58-
message(STATUS "GPU_ENABLE ${GPU_ENABLE}")
59-
message(STATUS "BUILD_TESTING ${BUILD_TESTING}")
60-
message(STATUS "NUMBA_ENABLE ${NUMBA_ENABLE}")
61-
message(STATUS "TBB_ENABLE ${TBB_ENABLE}")
6299

63-
include(CTest)
64100

65101
macro(apply_llvm_compile_flags target)
66102
if (MSVC)
@@ -70,18 +106,19 @@ macro(apply_llvm_compile_flags target)
70106
target_compile_definitions(${target} PRIVATE ${LLVM_DEFINITIONS})
71107
endmacro()
72108

73-
if(GPU_ENABLE)
109+
if(IMEX_ENABLE_IGPU_DIALECT)
74110
add_subdirectory(dpcomp_gpu_runtime)
75111
endif()
76112

77113
add_subdirectory(mlir)
78114
add_subdirectory(dpcomp_runtime)
79115
add_subdirectory(tools)
80116

81-
if(NUMBA_ENABLE)
117+
if(IMEX_ENABLE_NUMBA_FE)
82118
add_subdirectory(numba_dpcomp)
83119
endif()
84120

85-
if(BUILD_TESTING)
121+
if(IMEX_ENABLE_TESTS)
122+
include(CTest)
86123
add_subdirectory(test)
87124
endif()

dpcomp_runtime/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ project(dpcomp-runtime LANGUAGES CXX C)
1616

1717
include(GenerateExportHeader)
1818

19-
if(TBB_ENABLE)
19+
if(IMEX_ENABLE_TBB_SUPPORT)
2020
find_package(TBB REQUIRED)
2121
endif()
2222

@@ -39,7 +39,7 @@ target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE
3939
${PROJECT_BINARY_DIR}
4040
)
4141

42-
if(TBB_ENABLE)
43-
target_compile_definitions(${PROJECT_NAME} PRIVATE TBB_ENABLE=1)
42+
if(IMEX_ENABLE_TBB_SUPPORT)
43+
target_compile_definitions(${PROJECT_NAME} PRIVATE IMEX_ENABLE_TBB_SUPPORT=1)
4444
target_link_libraries(${PROJECT_NAME} TBB::tbb)
4545
endif()

dpcomp_runtime/lib/tbb_parallel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifdef TBB_ENABLE
15+
#ifdef IMEX_ENABLE_TBB_SUPPORT
1616

1717
#include <array>
1818
#include <cassert>
@@ -243,4 +243,4 @@ DPCOMP_RUNTIME_EXPORT void dpcompParallelFinalize() {
243243
globalContext.reset();
244244
}
245245
}
246-
#endif // TBB_ENABLE
246+
#endif // IMEX_ENABLE_TBB_SUPPORT

mlir/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ add_subdirectory(include/mlir-extensions/dialect/plier)
4141
add_subdirectory(include/mlir-extensions/dialect/plier_util)
4242
add_subdirectory(include/mlir-extensions/dialect/gpu_runtime/IR)
4343

44-
if (GPU_ENABLE)
44+
if (IMEX_ENABLE_IGPU_DIALECT)
4545
add_subdirectory(tools)
4646
endif()
4747

numba_dpcomp/numba_dpcomp/math_runtime/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE
3131
${PROJECT_BINARY_DIR}
3232
)
3333

34-
if(DPNP_ENABLE)
34+
if(IMEX_USE_DPNP)
3535
target_include_directories(${PROJECT_NAME} PRIVATE
3636
${DPNP_INCLUDE_DIR}
3737
)
@@ -45,5 +45,5 @@ if(DPNP_ENABLE)
4545
INSTALL_RPATH "${DPNP_RPATH}"
4646
)
4747

48-
target_compile_definitions(${PROJECT_NAME} PRIVATE DPNP_ENABLE=1)
48+
target_compile_definitions(${PROJECT_NAME} PRIVATE IMEX_USE_DPNP=1)
4949
endif()

numba_dpcomp/numba_dpcomp/math_runtime/lib/numpy_linalg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616

1717
#include "common.hpp"
1818

19-
#ifdef DPNP_ENABLE
19+
#ifdef IMEX_USE_DPNP
2020
#include <dpnp_iface.hpp>
2121
#endif
2222

2323
namespace {
2424
template <typename T>
2525
void eigImpl(Memref<2, const T> *input, Memref<1, T> *vals,
2626
Memref<2, T> *vecs) {
27-
#ifdef DPNP_ENABLE
27+
#ifdef IMEX_USE_DPNP
2828
dpnp_eig_c<T, T>(input->data, vals->data, vecs->data, input->dims[0]);
2929
#else
3030
(void)input;

numba_dpcomp/numba_dpcomp/mlir_compiler/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE
101101
PRIVATE
102102
./lib)
103103

104-
if(DPNP_ENABLE)
105-
target_compile_definitions(${PROJECT_NAME} PRIVATE DPNP_ENABLE=1)
104+
if(IMEX_USE_DPNP)
105+
target_compile_definitions(${PROJECT_NAME} PRIVATE IMEX_USE_DPNP=1)
106106
endif()
107107

108-
if(GPU_ENABLE)
109-
target_compile_definitions(${PROJECT_NAME} PRIVATE GPU_ENABLE=1)
108+
if(IMEX_ENABLE_IGPU_DIALECT)
109+
target_compile_definitions(${PROJECT_NAME} PRIVATE IMEX_ENABLE_IGPU_DIALECT=1)
110110
endif()
111111

112112
set(CMAKE_INSTALL_BINDIR ./numba_dpcomp/numba_dpcomp)
@@ -117,7 +117,7 @@ install(TARGETS dpcomp-runtime dpcomp-math-runtime dpcomp-python-runtime mlir_co
117117
LIBRARY DESTINATION numba_dpcomp/numba_dpcomp
118118
)
119119

120-
if(GPU_ENABLE)
120+
if(IMEX_ENABLE_IGPU_DIALECT)
121121
install(TARGETS dpcomp-gpu-runtime
122122
LIBRARY DESTINATION numba_dpcomp/numba_dpcomp
123123
)

numba_dpcomp/numba_dpcomp/mlir_compiler/lib/lowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ static void createPipeline(plier::PipelineRegistry &registry,
698698
registerParallelToTBBPipeline(registry);
699699

700700
if (settings.enableGpuPipeline) {
701-
#ifdef GPU_ENABLE
701+
#ifdef IMEX_ENABLE_IGPU_DIALECT
702702
registerLowerToGPUPipeline(registry);
703703
// TODO(nbpatel): Add Gpu->GpuRuntime & GpuRuntimetoLlvm Transformation
704704
#else

numba_dpcomp/numba_dpcomp/mlir_compiler/lib/py_module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
namespace {
2222
bool is_dpnp_supported() {
23-
#ifdef DPNP_ENABLE
23+
#ifdef IMEX_USE_DPNP
2424
return true;
2525
#else
2626
return false;

numba_dpcomp/setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
"-DCMAKE_INSTALL_PREFIX=" + CMAKE_INSTALL_PREFIX,
6464
"-DPython3_NumPy_INCLUDE_DIRS=" + NUMPY_INCLUDE_DIR,
6565
"-DPython3_FIND_STRATEGY=LOCATION",
66-
"-DNUMBA_ENABLE=ON",
67-
"-DTBB_ENABLE=ON",
66+
"-DIMEX_ENABLE_NUMBA_FE=ON",
67+
"-DIMEX_ENABLE_TBB_SUPPORT=ON",
6868
]
6969

7070
# DPNP
@@ -76,7 +76,7 @@
7676
cmake_cmd += [
7777
"-DDPNP_LIBRARY_DIR=" + DPNP_LIBRARY_DIR,
7878
"-DDPNP_INCLUDE_DIR=" + DPNP_INCLUDE_DIR,
79-
"-DDPNP_ENABLE=ON",
79+
"-DIMEX_USE_DPNP=ON",
8080
]
8181
print("Found DPNP at", DPNP_LIBRARY_DIR)
8282
except ImportError:
@@ -90,7 +90,7 @@
9090
print("LEVEL_ZERO_DIR is", LEVEL_ZERO_DIR)
9191
cmake_cmd += [
9292
"-DLEVEL_ZERO_DIR=" + LEVEL_ZERO_DIR,
93-
"-DGPU_ENABLE=ON",
93+
"-DIMEX_ENABLE_IGPU_DIALECT=ON",
9494
]
9595

9696
try:

0 commit comments

Comments
 (0)