This repository has been archived on 2026-11-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
radiance-sycl/sycl/CMakeLists.txt
T
claudeandClaude Opus 5.5 ea065f596c libxe2: the Intel kernel library's skeleton, and its first op, add
libxe2 is a kernel plugin like any other, built by rad_add_plugin from the icpx sub-build into the
build tree's $RADIANCE_HOME. It declares no schemas (every op it serves is libref's vocabulary), only
device rows, written with designated initialisers. xe2_common.h holds what every kernel needs: the
launch's queue (rad_sycl.h), row views over padded operands, refusals that name the geometry, and
libref's own dtype conversions so results round where the reference's do.

add passes rad-kbench against libref at tolerance zero, on the recorded fixture (30 cases) and on
MiniCPM5-2B's container (20 cases), inside guarded allocations. In a SYCL build the kbench replays
run libxe2 on the card, so they are labelled sycl there, as they are gpu in a HIP build.

scripts/sycl/notify.sh posts to the Discord webhook when the port needs the user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
2026-10-23 15:55:39 +02:00

68 lines
3.6 KiB
CMake

# The parts of radiance compiled by icpx: the SYCL device backend (librad_sycl.so) and, later, the
# Intel kernel library. The main project builds this directory through ExternalProject with icpx
# as the C++ compiler (top-level CMakeLists.txt, RAD_SYCL), so the engine and every host plugin
# stay on the main project's compiler (docs/SYCL_PORTING.md §4.5, docs/SYCL_PROGRESS.md D6).
cmake_minimum_required(VERSION 3.21)
project(radiance_sycl LANGUAGES CXX)
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
message(FATAL_ERROR "sycl/ is built by icpx (IntelLLVM); this configure has "
"${CMAKE_CXX_COMPILER_ID} at ${CMAKE_CXX_COMPILER}.")
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif()
set(RAD_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.." CACHE PATH "the radiance checkout")
set(RAD_SYCL_TARGETS "intel_gpu_bmg_g31" CACHE STRING "AOT targets for SYCL device code")
# The same warnings as the main build. icpx defaults to -fp-model=fast; host code here is precise
# as the main build's is, and device code keeps the main build's -ffp-contract=off discipline in
# the kernels themselves.
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
-ffp-model=precise)
set(RAD_SYCL_FLAGS -fsycl "-fsycl-targets=${RAD_SYCL_TARGETS}")
# The oneAPI runtime libraries sit beside the compiler; record their directory so the engine runs
# without setvars.sh in its environment.
get_filename_component(_icpx_bin "${CMAKE_CXX_COMPILER}" DIRECTORY)
get_filename_component(RAD_ONEAPI_LIBDIR "${_icpx_bin}/../lib" ABSOLUTE)
# ---------------------------------------------------------------- the device backend
# The backend, and the core's own kernels under it (the step's advance, the weight-table patches),
# each the SYCL twin of a .hip the AMD build compiles. The engine calls the kernels' launchers by
# the same names on either backend.
add_library(rad_sycl SHARED
${RAD_SOURCE_DIR}/core/device/sycl.cpp
${RAD_SOURCE_DIR}/core/device/sycl_host.cpp
${RAD_SOURCE_DIR}/core/sched/advance_sycl.cpp
${RAD_SOURCE_DIR}/core/runtime/wtab_sycl.cpp)
target_include_directories(rad_sycl PRIVATE
${RAD_SOURCE_DIR}/core/device ${RAD_SOURCE_DIR}/core ${RAD_SOURCE_DIR}/abi
${RAD_SOURCE_DIR}/vendor)
target_compile_definitions(rad_sycl PRIVATE RAD_HAVE_SYCL=1)
target_compile_options(rad_sycl PRIVATE ${RAD_SYCL_FLAGS} -fvisibility=hidden)
target_link_options(rad_sycl PRIVATE ${RAD_SYCL_FLAGS} "LINKER:-rpath,${RAD_ONEAPI_LIBDIR}"
"LINKER:--no-undefined")
set_target_properties(rad_sycl PROPERTIES OUTPUT_NAME rad_sycl)
# ---------------------------------------------------------------- the kernel library
# libxe2 is a plugin like any other: built by rad_add_plugin against the ABI headers alone, into
# the main build's $RADIANCE_HOME (RAD_PLUGIN_OUT, passed down by the main project). The variables
# cmake/RadAddPlugin.cmake expects describe a build with no HIP; libxe2 adds its SYCL flags itself.
set(RAD_PLUGIN_OUT "${CMAKE_BINARY_DIR}/radiance_home" CACHE PATH "the build tree's $RADIANCE_HOME")
set(RAD_HIP_FOUND OFF)
set(RAD_GPU_TARGETS "")
set(RAD_HIP_RUNTIME "")
# The sub-build installs nothing; the main project installs what it needs from here.
set(RAD_PLUGIN_INSTALL OFF)
add_library(rad_abi INTERFACE)
add_library(radiance::abi ALIAS rad_abi)
target_include_directories(rad_abi INTERFACE ${RAD_SOURCE_DIR}/abi)
include(GNUInstallDirs)
include(${RAD_SOURCE_DIR}/cmake/RadAddPlugin.cmake)
add_subdirectory(${RAD_SOURCE_DIR}/libxe2 ${CMAKE_BINARY_DIR}/libxe2)