Skip to content

Commit fbdae51

Browse files
committed
fix CMake provider options and ACPP_TARGETS handling
Restore DPCTL_WITH_REDIST and DPCTL_OFFLOAD_COMPRESS options, validate DPCTL_SYCL_PROVIDER, default it in a standalone libsyclinterface build, and derive ACPP_TARGETS (keeping generic) only when the user has not set it, without caching it.
1 parent 4ab3d52 commit fbdae51

2 files changed

Lines changed: 30 additions & 4 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ option(DPCTL_GENERATE_COVERAGE_FOR_PYBIND11_EXTENSIONS
2929
# SYCL provider selection
3030
set(DPCTL_SYCL_PROVIDER "Intel" CACHE STRING "SYCL compiler provider (Intel or AdaptiveCpp)")
3131
set_property(CACHE DPCTL_SYCL_PROVIDER PROPERTY STRINGS Intel AdaptiveCpp)
32+
if(NOT DPCTL_SYCL_PROVIDER MATCHES "^(Intel|AdaptiveCpp)$")
33+
message(FATAL_ERROR
34+
"DPCTL_SYCL_PROVIDER must be Intel or AdaptiveCpp, not '${DPCTL_SYCL_PROVIDER}'"
35+
)
36+
endif()
3237

3338
set(DPCTL_TARGET_CUDA
3439
""
@@ -42,6 +47,16 @@ set(DPCTL_TARGET_HIP
4247
CACHE STRING
4348
"Build DPCTL to target a HIP device architecture"
4449
)
50+
option(
51+
DPCTL_WITH_REDIST
52+
"Build DPCTL assuming DPC++ redistributable is installed into Python prefix"
53+
OFF)
54+
option(
55+
DPCTL_OFFLOAD_COMPRESS
56+
"Build using offload section compression feature of DPC++ to reduce \
57+
size of shared object with offloading sections"
58+
OFF
59+
)
4560

4661
# architecture mapping
4762
set(_dpctl_sycl_targets)
@@ -87,6 +102,11 @@ if ("x${DPCTL_SYCL_TARGETS}" STREQUAL "x")
87102
)
88103
endif()
89104
endif()
105+
106+
if(_acpp_targets_list)
107+
# generic runs dpctl's kernels on the OpenMP and OpenCL devices
108+
list(PREPEND _acpp_targets_list generic)
109+
endif()
90110
else()
91111
if ("${DPCTL_SYCL_TARGETS}" MATCHES "amdgcn-amd-amdhsa")
92112
message(FATAL_ERROR
@@ -117,10 +137,13 @@ if(DPCTL_SYCL_PROVIDER STREQUAL "Intel")
117137
elseif(DPCTL_SYCL_PROVIDER STREQUAL "AdaptiveCpp")
118138
message(STATUS "Using AdaptiveCpp SYCL Provider")
119139

120-
# AdaptiveCpp reads the ACPP_TARGETS variable directly during find_package
121-
if(_acpp_targets_list)
122-
string(REPLACE ";" ";" ACPP_TARGETS "${_acpp_targets_list}")
123-
set(ACPP_TARGETS "${ACPP_TARGETS}" CACHE STRING "AdaptiveCpp Targets" FORCE)
140+
# AdaptiveCpp reads ACPP_TARGETS during find_package. The empty cache entry
141+
# keeps the derived targets below out of the cache.
142+
set(ACPP_TARGETS "" CACHE STRING
143+
"AdaptiveCpp targets, derived from DPCTL_TARGET_CUDA, DPCTL_TARGET_HIP or DPCTL_SYCL_TARGETS if empty"
144+
)
145+
if(_acpp_targets_list AND NOT ACPP_TARGETS AND "$ENV{ACPP_TARGETS}" STREQUAL "")
146+
set(ACPP_TARGETS "${_acpp_targets_list}")
124147
message(STATUS "Compiling for ACPP_TARGETS=${ACPP_TARGETS}")
125148
endif()
126149

‎libsyclinterface/CMakeLists.txt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/mo
1111

1212
find_package(Git REQUIRED)
1313

14+
# set by the top-level project, defaulted for a standalone build
15+
set(DPCTL_SYCL_PROVIDER "Intel" CACHE STRING "SYCL compiler provider (Intel or AdaptiveCpp)")
16+
1417
if(DPCTL_SYCL_PROVIDER STREQUAL "Intel")
1518
if(NOT DEFINED IntelSYCL_FOUND OR NOT IntelSYCL_FOUND)
1619
find_package(IntelSYCL REQUIRED)

0 commit comments

Comments
 (0)