Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 63aaab3

Browse files
author
Sven Verdoolaege
committed
do not rely on CMakeLists.txt in isl submodule
Mainline isl uses autoconf/automake as a build system. The isl submodule used by TC is a heavily modified version of isl and also supports cmake. Reducing the difference and keeping up with changes in mainline isl occasionally requires changes to the build system configuration files. Having to perform the changes for both systems at the same time while merging is a needless additional complication. Support for cmake will therefore be removed from the modified version and TC can no longer rely on this support. There are at least two ways of handling the removal of cmake support from the isl submodule. The isl submodule could be configured as a cmake "external project" or the isl files can simply be compiled in directly. This commits opts for the second option based on the assumption that an external project will be more difficult to handle on Windows systems. Note that this commit also hard-codes some options that will not work on Windows, but setting these options correctly should not be too difficult for someone familiar with cmake. Note that if any source files get added to isl, then the local CMakeLists.txt still needs to get updated, but this can be done while updating the submodule and after the merge has been completed. The build files are stored in "external/isl", even though the object files are part of tc_core, because the source files live in third-party/islpp. They are not stored in "tc/external" because they involve extra files that are private to the (locally built) isl library, while "tc/external" contains the public interface to isl (within TC). It may make sense to move the contents of "tc/external" somewhere else, but that is a different issue.
1 parent 4d23ce0 commit 63aaab3

File tree

5 files changed

+136
-7
lines changed

5 files changed

+136
-7
lines changed

CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,11 @@ message(STATUS "Found ATen.so file: ${ATEN_LIBRARIES}")
226226
################################################################################
227227
# isl
228228
################################################################################
229-
set(ISL_INT "gmp" CACHE STRING "Which package to use to represent multi-precision integers (gmp|imath)")
230229
# use locally generated C++ bindings
231230
include_directories(AFTER ${PROJECT_SOURCE_DIR}/isl_interface/include)
232231
include_directories(AFTER ${PROJECT_SOURCE_DIR}/third-party/islpp/include)
233232
include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR}/third-party/islpp/include)
234-
add_subdirectory(third-party/islpp)
235-
set(ISL_LIBRARIES isl-static)
233+
add_subdirectory(external/isl)
236234

237235
################################################################################
238236
# Halide

external/isl/CMakeLists.txt

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
find_path(GMP_INCLUDE_DIR gmp.h)
2+
find_library(GMP_LIBRARY NAMES gmp)
3+
4+
set(ISL_SOURCE_DIR "${PROJECT_SOURCE_DIR}/third-party/islpp")
5+
6+
set(ISL_SOURCES
7+
${ISL_SOURCE_DIR}/basis_reduction_tab.c
8+
${ISL_SOURCE_DIR}/isl_aff.c
9+
${ISL_SOURCE_DIR}/isl_aff_map.c
10+
${ISL_SOURCE_DIR}/isl_affine_hull.c
11+
${ISL_SOURCE_DIR}/isl_arg.c
12+
${ISL_SOURCE_DIR}/isl_ast_build.c
13+
${ISL_SOURCE_DIR}/isl_ast_build_expr.c
14+
${ISL_SOURCE_DIR}/isl_ast.c
15+
${ISL_SOURCE_DIR}/isl_ast_codegen.c
16+
${ISL_SOURCE_DIR}/isl_ast_graft.c
17+
${ISL_SOURCE_DIR}/isl_bernstein.c
18+
${ISL_SOURCE_DIR}/isl_blk.c
19+
${ISL_SOURCE_DIR}/isl_bound.c
20+
${ISL_SOURCE_DIR}/isl_box.c
21+
${ISL_SOURCE_DIR}/isl_coalesce.c
22+
${ISL_SOURCE_DIR}/isl_constraint.c
23+
${ISL_SOURCE_DIR}/isl_convex_hull.c
24+
${ISL_SOURCE_DIR}/isl_ctx.c
25+
${ISL_SOURCE_DIR}/isl_deprecated.c
26+
${ISL_SOURCE_DIR}/isl_dim_map.c
27+
${ISL_SOURCE_DIR}/isl_equalities.c
28+
${ISL_SOURCE_DIR}/isl_factorization.c
29+
${ISL_SOURCE_DIR}/isl_farkas.c
30+
${ISL_SOURCE_DIR}/isl_ffs.c
31+
${ISL_SOURCE_DIR}/isl_flow.c
32+
${ISL_SOURCE_DIR}/isl_fold.c
33+
${ISL_SOURCE_DIR}/isl_hash.c
34+
${ISL_SOURCE_DIR}/isl_id.c
35+
${ISL_SOURCE_DIR}/isl_id_to_ast_expr.c
36+
${ISL_SOURCE_DIR}/isl_id_to_id.c
37+
${ISL_SOURCE_DIR}/isl_id_to_pw_aff.c
38+
${ISL_SOURCE_DIR}/isl_ilp.c
39+
${ISL_SOURCE_DIR}/isl_input.c
40+
${ISL_SOURCE_DIR}/isl_local.c
41+
${ISL_SOURCE_DIR}/isl_local_space.c
42+
${ISL_SOURCE_DIR}/isl_lp.c
43+
${ISL_SOURCE_DIR}/isl_map.c
44+
${ISL_SOURCE_DIR}/isl_map_list.c
45+
${ISL_SOURCE_DIR}/isl_map_simplify.c
46+
${ISL_SOURCE_DIR}/isl_map_subtract.c
47+
${ISL_SOURCE_DIR}/isl_map_to_basic_set.c
48+
${ISL_SOURCE_DIR}/isl_mat.c
49+
${ISL_SOURCE_DIR}/isl_morph.c
50+
${ISL_SOURCE_DIR}/isl_obj.c
51+
${ISL_SOURCE_DIR}/isl_options.c
52+
${ISL_SOURCE_DIR}/isl_output.c
53+
${ISL_SOURCE_DIR}/isl_point.c
54+
${ISL_SOURCE_DIR}/isl_polynomial.c
55+
${ISL_SOURCE_DIR}/isl_printer.c
56+
${ISL_SOURCE_DIR}/isl_range.c
57+
${ISL_SOURCE_DIR}/isl_reordering.c
58+
${ISL_SOURCE_DIR}/isl_sample.c
59+
${ISL_SOURCE_DIR}/isl_scan.c
60+
${ISL_SOURCE_DIR}/isl_schedule.c
61+
${ISL_SOURCE_DIR}/isl_schedule_band.c
62+
${ISL_SOURCE_DIR}/isl_schedule_node.c
63+
${ISL_SOURCE_DIR}/isl_schedule_read.c
64+
${ISL_SOURCE_DIR}/isl_schedule_tree.c
65+
${ISL_SOURCE_DIR}/isl_scheduler.c
66+
${ISL_SOURCE_DIR}/isl_schedule_constraints.c
67+
${ISL_SOURCE_DIR}/isl_seq.c
68+
${ISL_SOURCE_DIR}/isl_set_list.c
69+
${ISL_SOURCE_DIR}/isl_sort.c
70+
${ISL_SOURCE_DIR}/isl_space.c
71+
${ISL_SOURCE_DIR}/isl_stream.c
72+
${ISL_SOURCE_DIR}/isl_stride.c
73+
${ISL_SOURCE_DIR}/isl_tab.c
74+
${ISL_SOURCE_DIR}/isl_tab_pip.c
75+
${ISL_SOURCE_DIR}/isl_tarjan.c
76+
${ISL_SOURCE_DIR}/isl_transitive_closure.c
77+
${ISL_SOURCE_DIR}/isl_union_map.c
78+
${ISL_SOURCE_DIR}/isl_val.c
79+
${ISL_SOURCE_DIR}/isl_vec.c
80+
${ISL_SOURCE_DIR}/isl_version.c
81+
${ISL_SOURCE_DIR}/isl_vertices.c
82+
${ISL_SOURCE_DIR}/print.c
83+
${ISL_SOURCE_DIR}/isl_gmp.c
84+
${ISL_SOURCE_DIR}/isl_val_gmp.c
85+
)
86+
87+
# The tc_isl library is included in the (shared) tc_core library.
88+
add_library(tc_isl STATIC)
89+
set_property(TARGET tc_isl PROPERTY POSITION_INDEPENDENT_CODE ON)
90+
target_include_directories(
91+
tc_isl
92+
PRIVATE
93+
${PROJECT_SOURCE_DIR}/third-party/islpp
94+
${CMAKE_CURRENT_SOURCE_DIR}
95+
${CMAKE_CURRENT_BINARY_DIR}
96+
${GMP_INCLUDE_DIR}
97+
)
98+
target_sources(tc_isl PRIVATE ${ISL_SOURCES})
99+
target_link_libraries(tc_isl ${GMP_LIBRARY})
100+
101+
# The following sets "gitversion.h" only at configure time.
102+
# Since TC currently does not call isl_version(),
103+
# it is not worth it to try and be more accurate.
104+
execute_process(
105+
COMMAND ${GIT_EXECUTABLE} describe
106+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/third-party/islpp
107+
OUTPUT_VARIABLE ISL_GIT_VERSION
108+
OUTPUT_STRIP_TRAILING_WHITESPACE)
109+
configure_file("gitversion.h.in" "gitversion.h")

external/isl/gitversion.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define GIT_HEAD_ID "${ISL_GIT_VERSION}"

external/isl/isl_config.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* Hard-coded configuration variables. */
2+
3+
/* define if your compiler has __attribute__ */
4+
#define HAVE___ATTRIBUTE__ /**/
5+
6+
/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */
7+
#define HAVE_DECL_FFS 1
8+
9+
/* Define to 1 if you have the declaration of `strcasecmp', and to 0 if you
10+
don't. */
11+
#define HAVE_DECL_STRCASECMP 1
12+
13+
/* Define to 1 if you have the declaration of `strncasecmp', and to 0 if you
14+
don't. */
15+
#define HAVE_DECL_STRNCASECMP 1
16+
17+
/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
18+
don't. */
19+
#define HAVE_DECL_SNPRINTF 1
20+
21+
/* use gmp to implement isl_int */
22+
#define USE_GMP_FOR_MP
23+
24+
#include <isl_config_post.h>

tc/core/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ target_link_libraries(
4343
glog
4444

4545
${HALIDE_LIBRARIES}
46-
${ISL_LIBRARIES}
4746
-lLLVM
4847

48+
tc_isl
4949
tc_lang
5050
tc_version
5151
tc_proto
@@ -82,7 +82,6 @@ target_link_libraries(
8282
tc_core_cpu
8383

8484
${HALIDE_LIBRARIES}
85-
${ISL_LIBRARIES}
8685
-lLLVM
8786

8887
tc_lang
@@ -129,7 +128,6 @@ target_link_libraries(
129128
tc_core_cuda_no_sdk
130129

131130
${HALIDE_LIBRARIES}
132-
${ISL_LIBRARIES}
133131
-lLLVM
134132

135133
tc_lang
@@ -174,7 +172,6 @@ if (WITH_CUDA)
174172
${CUDA_curand_LIBRARY}
175173
${CUDA_LIBRARIES}
176174
${CUDA_NVRTC_LIBRARIES}
177-
${ISL_LIBRARIES}
178175

179176
tc_lang
180177
tc_version

0 commit comments

Comments
 (0)