Skip to content

Commit 35890ba

Browse files
authored
Merge pull request #1210 from IntelPython/feature/switch_to_sycl_compiler
Switch to sycl compiler
2 parents 6f670d6 + 5f70c5c commit 35890ba

File tree

4 files changed

+41
-3
lines changed

4 files changed

+41
-3
lines changed

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Build numba-dpex
3939
run: |
4040
export PATH=$CONDA/bin-llvm:$PATH
41-
python setup.py develop
41+
CC=icx CXX=icpx python setup.py develop
4242
4343
- name: Test installation
4444
run: |

conda-recipe/bld.bat

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33
@REM used BUILD_PREFIX as compiler installed in build section of meta.yml
44
set "PATH=%BUILD_PREFIX%\Library\bin-llvm;%PATH%"
55

6+
REM A workaround for activate-dpcpp.bat issue to be addressed in 2021.4
7+
set "LIB=%BUILD_PREFIX%\Library\lib;%BUILD_PREFIX%\compiler\lib;%LIB%"
8+
SET "INCLUDE=%BUILD_PREFIX%\include;%INCLUDE%"
9+
10+
REM Since the 60.0.0 release, setuptools includes a local, vendored copy
11+
REM of distutils (from late copies of CPython) that is enabled by default.
12+
REM It breaks build for Windows, so use distutils from "stdlib" as before.
13+
REM @TODO: remove the setting, once transition to build backend on Windows
14+
REM to cmake is complete.
15+
SET "SETUPTOOLS_USE_DISTUTILS=stdlib"
16+
17+
set "CC=icx"
18+
set "CXX=icx"
19+
620
set "SKBUILD_ARGS=-G Ninja --"
721
set "SKBUILD_ARGS=%SKBUILD_ARGS% -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
822

conda-recipe/build.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
set -euxo pipefail
44

5+
# Intel LLVM must cooperate with compiler and sysroot from conda
6+
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}:${BUILD_PREFIX}/lib"
7+
8+
echo "--gcc-toolchain=${BUILD_PREFIX} --sysroot=${BUILD_PREFIX}/${HOST}/sysroot -target ${HOST}" > icpx_for_conda.cfg
9+
ICPXCFG="$(pwd)/icpx_for_conda.cfg"
10+
ICXCFG="$(pwd)/icpx_for_conda.cfg"
11+
12+
export ICXCFG
13+
export ICPXCFG
14+
15+
export CC=icx
16+
export CXX=icpx
17+
518
# new llvm-spirv location
619
# starting from dpcpp_impl_linux-64=2022.0.0=intel_3610
720
export PATH=$CONDA_PREFIX/bin-llvm:$PATH

numba_dpex/core/runtime/CMakeLists.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ project(_dpexrt_python
2424
DESCRIPTION "A Python C extension for numba-dpex runtime."
2525
)
2626

27+
# Help conda build find path from both host and build env.
28+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
29+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
30+
2731
# Get numba include path
2832
if(NOT DEFINED Numba_INCLUDE_DIRS)
2933
execute_process(
@@ -79,9 +83,10 @@ message(STATUS "CMAKE_MODULE_PATH=" "${CMAKE_MODULE_PATH}")
7983

8084
# Add packages
8185
find_package(Python 3.9 REQUIRED
82-
COMPONENTS Interpreter Development.Module NumPy)
86+
COMPONENTS Interpreter Development.Module)
8387
find_package(Dpctl REQUIRED)
8488
find_package(NumPy REQUIRED)
89+
find_package(IntelSYCL REQUIRED)
8590

8691
# Includes
8792
include(GNUInstallDirs)
@@ -92,14 +97,20 @@ include_directories(${Dpctl_INCLUDE_DIRS})
9297
include_directories(.)
9398

9499
# Source files, *.c
95-
file(GLOB SOURCES "*.c")
100+
file(GLOB_RECURSE DPEXRT_SOURCES CONFIGURE_DEPENDS "*.c")
101+
file(GLOB_RECURSE KERNEL_SOURCES CONFIGURE_DEPENDS "*.cpp")
102+
set(SOURCES ${DPEXRT_SOURCES} ${KERNEL_SOURCES})
96103

97104
# Link dpctl library path with -L
98105
link_directories(${DPCTL_LIBRARY_PATH})
99106

100107
# Output static library, *.so or *.dll
101108
python_add_library(${PROJECT_NAME} MODULE ${SOURCES})
102109

110+
# Add SYCL to target, this must come after python_add_library()
111+
# FIXME: sources incompatible with sycl include?
112+
# add_sycl_to_target(TARGET ${PROJECT_NAME} SOURCES ${KERNEL_SOURCES})
113+
103114
# Link the DPCTLSyclInterface library to target
104115
target_link_libraries(${PROJECT_NAME} PRIVATE DPCTLSyclInterface)
105116

0 commit comments

Comments
 (0)