Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 54 additions & 1 deletion .github/workflows/os-llvm-sycl-build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,28 @@ jobs:
$PSNativeCommandUseErrorActionPreference = $true
python -m pip install numpy cython "setuptools<80" pytest scikit-build cmake ninja "versioneer[toml]==0.29"

- name: Build GTest
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
GTEST_VERSION: 1.15.2
run: |
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true

$root = Join-Path $env:RUNNER_TEMP 'gtest'
$install = Join-Path $root 'install'
gh release download "v$env:GTEST_VERSION" -R google/googletest --archive tar.gz -D $root
& "$env:SystemRoot\System32\tar.exe" -xzf (Join-Path $root "googletest-$env:GTEST_VERSION.tar.gz") -C $root
$src = Join-Path $root "googletest-$env:GTEST_VERSION"
$build = Join-Path $root 'build'
# -fsycl links the dynamic CRT, so GTest must too
cmake -S $src -B $build -A x64 -DBUILD_GMOCK=OFF -Dgtest_force_shared_crt=ON `
"-DCMAKE_INSTALL_PREFIX=$install"
cmake --build $build --config Release --target install
$gtestDir = (Join-Path $install 'lib\cmake\GTest').Replace('\', '/')
Add-Content -Path $env:GITHUB_ENV -Value "GTEST_DIR=$gtestDir"

- name: Report compiler version
shell: pwsh
run: clang-cl --version
Expand Down Expand Up @@ -163,7 +185,21 @@ jobs:
rem link.exe can't link the LTO bitcode pybind11 would otherwise build
python scripts\build_locally.py --c-compiler=clang-cl.exe --cxx-compiler=clang-cl.exe ^
--compiler-root="%SYCL_BUNDLE_FOLDER%\dpcpp_compiler\bin" ^
--cmake-opts="-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF" || exit /b 1
--cmake-opts="-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF -DDPCTL_BUILD_CAPI_TESTS=ON -DGTest_DIR=%GTEST_DIR%" || exit /b 1
set "BUILD_DIR="
for /d %%d in (_skbuild\*) do (
if defined BUILD_DIR (
echo ::error::more than one build directory in _skbuild
exit /b 1
)
set "BUILD_DIR=%CD%\%%d\cmake-build"
)
if not defined BUILD_DIR (
echo ::error::no build directory in _skbuild
exit /b 1
)
echo BUILD_DIR=%BUILD_DIR%>> "%GITHUB_ENV%"
echo VS_PATH=%VS_PATH%>> "%GITHUB_ENV%"

- name: Run lsplatforms
shell: pwsh
Expand All @@ -180,3 +216,20 @@ jobs:
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true
python -m pytest -sv dpctl/tests

- name: Build C-API tests
shell: cmd
run: |
call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat" || exit /b 1
set "LIB=%SYCL_BUNDLE_FOLDER%\dpcpp_compiler\lib;%LIB%"
cmake --build "%BUILD_DIR%" --target dpctl_c_api_tests || exit /b 1

- name: Run C-API tests
shell: pwsh
env:
DPCTL_VERBOSITY: warning
run: |
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true
Set-Location (Join-Path $env:BUILD_DIR 'libsyclinterface\tests')
.\dpctl_c_api_tests.exe
26 changes: 24 additions & 2 deletions .github/workflows/os-llvm-sycl-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ jobs:
run: |
sudo apt install lld

- name: Install GTest
shell: bash -l {0}
run: |
sudo apt install -y libgtest-dev

- name: Cache sycl bundle
id: cache-sycl-bundle
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
Expand Down Expand Up @@ -144,7 +149,8 @@ jobs:
mkdir -p oclcpuexp
[ -d oclcpuexp/x64 ] || tar xf "${OCLCPUEXP_FN}" -C oclcpuexp || exit 1
[ -d "${TBB_INSTALL_DIR}/lib" ] || tar xf "${TBB_FN}" || exit 1
cp -f oclcpuexp/x64/libOpenCL.so* dpcpp_compiler/lib/ || exit 1
# earlier runs copied the OpenCL loader into the cached bundle
rm -f dpcpp_compiler/lib/libOpenCL.so*

- name: Setup Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
Expand Down Expand Up @@ -190,7 +196,8 @@ jobs:
run: |
source set_allvars.sh
python scripts/build_locally.py --c-compiler=clang --cxx-compiler=clang++ \
--compiler-root="${SYCL_BUNDLE_FOLDER}/dpcpp_compiler/bin" || exit 1
--compiler-root="${SYCL_BUNDLE_FOLDER}/dpcpp_compiler/bin" \
--cmake-opts="-DDPCTL_BUILD_CAPI_TESTS=ON" || exit 1
Comment thread
ndgrigorian marked this conversation as resolved.
Resolved

- name: Run lsplatforms
shell: bash -l {0}
Expand All @@ -205,3 +212,18 @@ jobs:
run: |
source set_allvars.sh
python -m pytest -sv dpctl/tests

- name: Build C-API tests
shell: bash -l {0}
run: |
source set_allvars.sh
cmake --build _skbuild/*/cmake-build --target dpctl_c_api_tests

- name: Run C-API tests
shell: bash -l {0}
env:
DPCTL_VERBOSITY: warning
run: |
source set_allvars.sh
cd _skbuild/*/cmake-build/libsyclinterface/tests
./dpctl_c_api_tests
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* A USM allocation that fails now drops the references held for offloaded tasks that have completed, and is attempted once more if that released anything, so that memory only waiting to be given up is not reported as unavailable [gh-2359](https://github.com/IntelPython/dpctl/pull/2359)
* `dpctl.SyclPlatform.get_devices` no longer prints Unified Runtime warnings for `device_type="custom"` on non-OpenCL platforms, where custom devices are not supported [gh-2306](https://github.com/IntelPython/dpctl/pull/2306)
* Fixed building with the open source DPC++ compiler and CMake 4.5 or newer, which identifies it as `DPClang` instead of `Clang` [gh-2433](https://github.com/IntelPython/dpctl/pull/2433)
* Building with the open source DPC++ toolchain no longer requires the toolchain to bundle the OpenCL ICD loader, which `dpctl` loads at run time [gh-2435](https://github.com/IntelPython/dpctl/pull/2435)

### Maintenance
* Removed the `-fno-sycl-id-queries-fit-in-int` compile option, which none of the `dpctl` extensions need since `dpctl.tensor` moved to `dpnp` [gh-2413](https://github.com/IntelPython/dpctl/pull/2413)
* The C-API tests are now built and run in the workflows using the open source DPC++ compiler on Linux and Windows [gh-2435](https://github.com/IntelPython/dpctl/pull/2435)

## [0.23.0] - Oct. 22, 2026

Expand Down
12 changes: 0 additions & 12 deletions libsyclinterface/cmake/modules/FindIntelSyclCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
# IntelSyclCompiler_SYCL_INCLUDE_DIR
# IntelSyclCompiler_LIBRARY_DIR
# IntelSyclCompiler_SYCL_LIBRARY
# IntelSyclCompiler_OPENCL_LIBRARY

include(FindPackageHandleStandardArgs)
if(NOT DEFINED IntelSYCL_FOUND OR NOT IntelSYCL_FOUND)
Expand Down Expand Up @@ -128,22 +127,12 @@ if(${clangxx_result} MATCHES "0")
NAMES "sycl.lib" "sycl6.lib" "sycl7.lib" "sycl8.lib"
PATHS ${IntelSyclCompiler_LIBRARY_DIR}
)
find_file(
IntelSyclCompiler_OPENCL_LIBRARY
NAMES "OpenCL.lib"
PATHS ${IntelSyclCompiler_LIBRARY_DIR}
)
elseif("x${CMAKE_SYSTEM_NAME}" STREQUAL "xLinux")
find_file(
IntelSyclCompiler_SYCL_LIBRARY
NAMES "libsycl.so"
PATHS ${IntelSyclCompiler_LIBRARY_DIR}
)
find_file(
IntelSyclCompiler_OPENCL_LIBRARY
NAMES "libOpenCL.so"
PATHS ${IntelSyclCompiler_LIBRARY_DIR}
)
endif()

endif()
Expand Down Expand Up @@ -172,5 +161,4 @@ find_package_handle_standard_args(IntelSyclCompiler DEFAULT_MSG
IntelSyclCompiler_SYCL_INCLUDE_DIR
IntelSyclCompiler_LIBRARY_DIR
IntelSyclCompiler_SYCL_LIBRARY
IntelSyclCompiler_OPENCL_LIBRARY
)
13 changes: 10 additions & 3 deletions libsyclinterface/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ target_link_libraries(dpctl_c_api_tests
GTest::gtest_main
GTest::GTest
DPCTLSyclInterface
${IntelSyclCompiler_OPENCL_LIBRARY}
# Seems to work without it...
${CMAKE_DL_LIBS}
)
target_include_directories(dpctl_c_api_tests
PRIVATE
Expand Down Expand Up @@ -181,5 +178,15 @@ if(DPCTL_GENERATE_COVERAGE)
)
endif()

if(WIN32)
# Windows has no rpath, and test discovery runs the executable after the
# link, so put DPCTLSyclInterface.dll next to it
add_custom_command(TARGET dpctl_c_api_tests POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:DPCTLSyclInterface>
$<TARGET_FILE_DIR:dpctl_c_api_tests>
)
endif()

gtest_discover_tests(dpctl_c_api_tests)
add_dependencies(check dpctl_c_api_tests)
14 changes: 10 additions & 4 deletions libsyclinterface/tests/test_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "Config/dpctl_config.h"
#include "dpctl_service.h"
#include "dpctl_utils.h"
#include <gtest/gtest.h>
#include <string>

Expand All @@ -36,13 +37,18 @@ TEST(TestServicesFns, ChkDPCPPVersion)
{
auto c_ver = DPCTLService_GetDPCPPVersion();
std::string ver = std::string(c_ver);
DPCTLCString_Delete(c_ver);
ASSERT_TRUE(ver.length() > 0);

std::string ver_from_cmplr(ASSTR(__VERSION__));
auto found = ver_from_cmplr.find(ver);

// version returned by DPCTLService_GetDPCPPVersion
// should occur as a substring in the version obtained
// from compiler
ASSERT_TRUE(found != std::string::npos);
std::string ver_from_cmplr(ASSTR(__VERSION__));
bool found = ver_from_cmplr.find(ver) != std::string::npos;
#ifdef __clang_version__
// open source DPC++ reports its clang version, which __VERSION__ omits
std::string clang_ver(ASSTR(__clang_version__));
found = found || clang_ver.find(ver) != std::string::npos;
#endif
Comment thread
ndgrigorian marked this conversation as resolved.
Resolved
ASSERT_TRUE(found);
}
Loading