Skip to content

Commit c5ea03a

Browse files
Merge branch 'maintenance/0.18.x' into backport-to-maintenance-0.18.x/gh-1899
2 parents ed86710 + 472f6ca commit c5ea03a

File tree

14 files changed

+115
-64
lines changed

14 files changed

+115
-64
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010

1111
* Add missing include of SYCL header to "math_utils.hpp" [gh-1899](https://github.com/IntelPython/dpctl/pull/1899)
1212

13+
### Fixed
14+
15+
* Fix for `tensor.result_type` when all inputs are Python built-in scalars [gh-1904](https://github.com/IntelPython/dpctl/pull/1904)
16+
17+
1318
## [0.18.1] - Oct. 11, 2024
1419

1520
### Changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ option(DPCTL_TARGET_CUDA
2929
"Build DPCTL to target CUDA devices"
3030
OFF
3131
)
32+
option(DPCTL_WITH_REDIST "Build DPCTL assuming DPC++ redistributable is installed into Python prefix" OFF)
3233

3334
find_package(IntelSYCL REQUIRED PATHS ${CMAKE_SOURCE_DIR}/cmake NO_DEFAULT_PATH)
3435

conda-recipe/bld.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if DEFINED OVERRIDE_INTEL_IPO (
1010
set "CMAKE_ARGS=%CMAKE_ARGS% -DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=FALSE"
1111
)
1212

13-
FOR %%V IN (14.0.0 14 15.0.0 15 16.0.0 16 17.0.0 17) DO @(
13+
FOR %%V IN (17.0.0 17 18.0.0 18 19.0.0 19) DO @(
1414
REM set DIR_HINT if directory exists
1515
IF EXIST "%BUILD_PREFIX%\Library\lib\clang\%%V\" (
1616
SET "SYCL_INCLUDE_DIR_HINT=%BUILD_PREFIX%\Library\lib\clang\%%V"

conda-recipe/build.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
# This is necessary to help DPC++ find Intel libraries such as SVML, IRNG, etc in build prefix
4-
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${BUILD_PREFIX}/lib"
4+
export LIBRARY_PATH="$LIBRARY_PATH:${BUILD_PREFIX}/lib"
55

66
# Intel LLVM must cooperate with compiler and sysroot from conda
77
echo "--gcc-toolchain=${BUILD_PREFIX} --sysroot=${BUILD_PREFIX}/${HOST}/sysroot -target ${HOST}" > icpx_for_conda.cfg
@@ -22,7 +22,7 @@ export CMAKE_GENERATOR=Ninja
2222
# Make CMake verbose
2323
export VERBOSE=1
2424

25-
CMAKE_ARGS="${CMAKE_ARGS} -DDPCTL_LEVEL_ZERO_INCLUDE_DIR=${PREFIX}/include/level_zero"
25+
CMAKE_ARGS="${CMAKE_ARGS} -DDPCTL_LEVEL_ZERO_INCLUDE_DIR=${PREFIX}/include/level_zero -DDPCTL_WITH_REDIST=ON"
2626

2727
# -wnx flags mean: --wheel --no-isolation --skip-dependency-check
2828
${PYTHON} -m build -w -n -x
@@ -43,7 +43,3 @@ ${PYTHON} -m pip install dist/dpctl*.whl \
4343
if [[ -d "${WHEELS_OUTPUT_FOLDER}" ]]; then
4444
cp dist/dpctl*.whl "${WHEELS_OUTPUT_FOLDER[@]}"
4545
fi
46-
47-
# need to create this folder so ensure that .dpctl-post-link.sh can work correctly
48-
mkdir -p $PREFIX/etc/OpenCL/vendors
49-
echo "dpctl creates symbolic link to system installed /etc/OpenCL/vendors/intel.icd as a work-around." > $PREFIX/etc/OpenCL/vendors/.dpctl_readme

conda-recipe/meta.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ requirements:
2929
- pip >=24.0
3030
- level-zero-devel >=1.16
3131
- pybind11 >=2.12
32-
- {{ pin_compatible('dpcpp-cpp-rt', min_pin='x.x', max_pin='x') }}
32+
- {{ pin_compatible('intel-sycl-rt', min_pin='x.x', max_pin='x') }}
33+
- {{ pin_compatible('intel-cmplr-lib-rt', min_pin='x.x', max_pin='x') }}
3334
# Ensure we are using latest version of setuptools, since we don't need
3435
# editable environments for release.
3536
- setuptools >=69
@@ -51,7 +52,7 @@ requirements:
5152
- tomli # [py<311]
5253
run:
5354
- python
54-
- {{ pin_compatible('dpcpp-cpp-rt', min_pin='x.x', max_pin='x') }}
55+
- {{ pin_compatible('intel-sycl-rt', min_pin='x.x', max_pin='x') }}
5556
- {{ pin_compatible('intel-cmplr-lib-rt', min_pin='x.x', max_pin='x') }}
5657
- numpy
5758

dpctl/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ set(CMAKE_INSTALL_RPATH "$ORIGIN")
105105

106106
function(build_dpctl_ext _trgt _src _dest)
107107
set(options SYCL)
108-
cmake_parse_arguments(BUILD_DPCTL_EXT "${options}" "" "" ${ARGN})
108+
cmake_parse_arguments(BUILD_DPCTL_EXT "${options}" "RELATIVE_PATH" "" ${ARGN})
109109
add_cython_target(${_trgt} ${_src} CXX OUTPUT_VAR _generated_src)
110110
set(_cythonize_trgt "${_trgt}_cythonize_pyx")
111111
Python_add_library(${_trgt} MODULE WITH_SOABI ${_generated_src})
@@ -146,6 +146,14 @@ function(build_dpctl_ext _trgt _src _dest)
146146
get_filename_component(_generated_src_dir_dir ${_generated_src_dir} DIRECTORY)
147147
# TODO: do not set directory if we did not generate header
148148
target_include_directories(${_trgt} INTERFACE ${_generated_src_dir_dir})
149+
set(_rpath_value "$ORIGIN")
150+
if (BUILD_DPCTL_EXT_RELATIVE_PATH)
151+
set(_rpath_value "${_rpath_value}/${BUILD_DPCTL_EXT_RELATIVE_PATH}")
152+
endif()
153+
if (DPCTL_WITH_REDIST)
154+
set(_rpath_value "${_rpath_value}:${_rpath_value}/../../..")
155+
endif()
156+
set_target_properties(${_trgt} PROPERTIES INSTALL_RPATH ${_rpath_value})
149157

150158
install(TARGETS ${_trgt}
151159
LIBRARY DESTINATION ${_dest})

dpctl/memory/CMakeLists.txt

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

22
set(_cy_file ${CMAKE_CURRENT_SOURCE_DIR}/_memory.pyx)
33
get_filename_component(_trgt ${_cy_file} NAME_WLE)
4-
build_dpctl_ext(${_trgt} ${_cy_file} "dpctl/memory" SYCL)
4+
build_dpctl_ext(${_trgt} ${_cy_file} "dpctl/memory" SYCL RELATIVE_PATH "..")
55
# _memory include _opaque_smart_ptr.hpp
66
target_include_directories(${_trgt} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
77
target_link_libraries(DpctlCAPI INTERFACE ${_trgt}_headers)

dpctl/program/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
file(GLOB _cython_sources *.pyx)
33
foreach(_cy_file ${_cython_sources})
44
get_filename_component(_trgt ${_cy_file} NAME_WLE)
5-
build_dpctl_ext(${_trgt} ${_cy_file} "dpctl/program")
5+
build_dpctl_ext(${_trgt} ${_cy_file} "dpctl/program" RELATIVE_PATH "..")
66
target_link_libraries(DpctlCAPI INTERFACE ${_trgt}_headers)
77
endforeach()

dpctl/tensor/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
file(GLOB _cython_sources *.pyx)
22
foreach(_cy_file ${_cython_sources})
33
get_filename_component(_trgt ${_cy_file} NAME_WLE)
4-
build_dpctl_ext(${_trgt} ${_cy_file} "dpctl/tensor")
4+
build_dpctl_ext(${_trgt} ${_cy_file} "dpctl/tensor" RELATIVE_PATH "..")
55
target_include_directories(${_trgt} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
66
target_link_libraries(DpctlCAPI INTERFACE ${_trgt}_headers)
77
endforeach()
@@ -284,5 +284,12 @@ foreach(python_module_name ${_py_trgts})
284284
# TODO: update source so they refernece individual libraries instead of
285285
# dpctl4pybind11.hpp. It will allow to simplify dependency tree
286286
target_link_libraries(${python_module_name} PRIVATE DpctlCAPI)
287+
if (DPCTL_WITH_REDIST)
288+
set_target_properties(
289+
${python_module_name}
290+
PROPERTIES
291+
INSTALL_RPATH "$ORIGIN/../../../.."
292+
)
293+
endif()
287294
install(TARGETS ${python_module_name} DESTINATION "dpctl/tensor")
288295
endforeach()

dpctl/tensor/_type_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,9 @@ def result_type(*arrays_and_dtypes):
767767
target_dev = d
768768
inspected = True
769769

770+
if not dtypes and weak_dtypes:
771+
dtypes.append(weak_dtypes[0].get())
772+
770773
if not (has_fp16 and has_fp64):
771774
for dt in dtypes:
772775
if not _dtype_supported_by_device_impl(dt, has_fp16, has_fp64):

0 commit comments

Comments
 (0)