Archived
A fourth DeviceBackend, in librad_sycl.so: in-order sycl::queues on one context, events as barriers, copies and fills on the queue, gates as a spin kernel on a pinned flag, and the core's advance and weight-table kernels as SYCL twins of their .hip files. RadStreams are RadSyclStreams (abi/rad_sycl.h). Pinned host memory is page-aligned memory registered for device copies, since O_DIRECT cannot read into SYCL's malloc_host pages; event timing is opt-in (RADIANCE_SYCL_TIMING=1) because profiling queues cost ~20 us of host time a submission. The SYCL code is its own CMake project, sycl/, configured with icpx through ExternalProject, so the engine and every host plugin stay on the main compiler: a SYCL build's host code is the default build's. RAD_SYCL (default OFF), build.sh --sycl, the sycl presets; HIP and SYCL in one build are refused at configure. On the SYCL backend --tp > 1 and ops resolved only to host kernels stop the start, since the Intel backend runs on one card and never puts an op on the CPU. A SYCL build that sees no GPU warns that it runs on the CPU and names the missing oneAPI environment. device_test runs on the Arc Pro B65 as device_test_sycl (label sycl): 36 cases pass, 12 skip (elastic memory, not provided; host-backend-only cases). Host tests hide Level Zero GPUs with ONEAPI_DEVICE_SELECTOR. The host tier is the baseline's in both the default and the SYCL build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
51 lines
2.7 KiB
CMake
51 lines
2.7 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)
|