Skip to content

[sycl-jit] Allow GCC host builds by not elevating -Wconversion to errors#21933

Merged
dm-vodopyanov merged 1 commit intointel:syclfrom
lslusarczyk:sycl-jit-conversion
May 7, 2026
Merged

[sycl-jit] Allow GCC host builds by not elevating -Wconversion to errors#21933
dm-vodopyanov merged 1 commit intointel:syclfrom
lslusarczyk:sycl-jit-conversion

Conversation

@lslusarczyk
Copy link
Copy Markdown
Contributor

@lslusarczyk lslusarczyk commented May 5, 2026

Summary

Add -Wno-error=conversion only for the sycl-jit target under g++ compiler so the SYCL JIT library can be built when the LLVM/SYCL tree is configured with GNU g++ as the host C++ compiler, while keeping -Wconversion and the rest of SYCL_JIT_WARNING_FLAGS / -Werror behavior for other diagnostics or for other compilers.

Problem

With SYCL_JIT_ENABLE_WERROR on (default), sycl-jit uses -Wall -Wextra -Wconversion -Werror. Compiling lib/rtc/DeviceCompilation.cpp pulls in Clang headers (e.g. via the Driver). Under g++ 13.3.0 (/usr/bin/g++, Ubuntu 13.3.0-6ubuntu2~24.04.1), those headers trigger a large number of -Wconversion warnings, which fail the build under -Werror.

Solution

target_compile_options(sycl-jit PRIVATE -Wno-error=conversion) in sycl-jit/jit-compiler/CMakeLists.txt: conversion issues are still reported as warnings for g++, but no longer abort the sycl-jit build.

Compilation errors observed (representative)

The build stopped on DeviceCompilation.cpp with warnings treated as errors, for example:

FAILED: tools/sycl-jit/jit-compiler/CMakeFiles/sycl-jit.dir/lib/rtc/DeviceCompilation.cpp.o
.../install_.../include/clang/Basic/FileEntry.h:251:22: error: conversion from 'size_t' {aka 'long unsigned int'} to 'unsigned int' may change value [-Werror=conversion]
.../install_.../include/clang/Basic/DiagnosticIDs.h:124:23: error: conversion from 'unsigned int' to 'unsigned char:3' may change value [-Werror=conversion]
.../install_.../include/clang/Basic/LangOptions.h:688:12: error: conversion from 'unsigned int' to 'unsigned char:2' may change value [-Werror=conversion]
.../install_.../include/clang/Basic/TargetInfo.h:559:51: error: conversion from 'uint64_t' {aka 'long unsigned int'} to 'unsigned int' may change value [-Werror=conversion]
.../install_.../include/clang/Frontend/FrontendOptions.h:188:22: error: conversion from 'unsigned int' to 'unsigned char:3' may change value [-Werror=conversion]
cc1plus: all warnings being treated as errors
ninja: build stopped: subcommand failed.

Host toolchain

CMAKE_CXX_COMPILER=/usr/bin/g++
g++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0

Testing

Reconfigured and rebuilt the project with the existing configure/build workflow; sycl-jit and SYCL install steps complete with this change.

sycl-jit is built with SYCL_JIT_WARNING_FLAGS (-Wall -Wextra -Wconversion,
and -Werror when SYCL_JIT_ENABLE_WERROR is on). Translation units such as
DeviceCompilation.cpp include Clang Driver/Frontend headers; when the LLVM/SYCL
tree is configured with GNU g++ as the host C++ compiler, those headers can
produce many -Wconversion diagnostics. With -Werror enabled, that aborts the
sycl-jit build.

Add -Wno-error=conversion for the sycl-jit target only when the host CXX
compiler is GCC (CMake GNU compiler id). Warnings still appear; they are no
longer elevated to errors for that diagnostic group
@lslusarczyk lslusarczyk force-pushed the sycl-jit-conversion branch from 5fd8a22 to f06582a Compare May 5, 2026 10:07
@lslusarczyk lslusarczyk marked this pull request as ready for review May 6, 2026 05:18
@lslusarczyk lslusarczyk requested review from a team and cperkinsintel as code owners May 6, 2026 05:18
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

@intel/llvm-gatekeepers please consider merging

@dm-vodopyanov dm-vodopyanov merged commit 4cb2617 into intel:sycl May 7, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants