Archived
device: the SYCL backend -- Intel GPUs through oneAPI over Level Zero
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
This commit is contained in:
1 parent
17524c95bd
commit
8addda231b
19 files changed
+1302
-39
No files matched your search
@@ -84,6 +84,38 @@ elseif(NOT RAD_HIPCC)
|
||||
"/opt/rocm/llvm/bin and $ROCM_PATH.")
|
||||
endif()
|
||||
|
||||
# ---------------------------------------------------------------- SYCL detection
|
||||
# The Intel GPU backend (docs/SYCL_PORTING.md). Off by default. SYCL code is compiled and linked by
|
||||
# icpx in a sub-build of its own (sycl/CMakeLists.txt, added below), so everything else stays on
|
||||
# this project's compiler: a SYCL build's host code is the default build's.
|
||||
#
|
||||
# RAD_SYCL_TARGETS names the AOT targets (icpx -fsycl-targets spelling); the default is the Arc Pro
|
||||
# B65's Battlemage G31.
|
||||
set(RAD_SYCL "OFF" CACHE STRING "ON | OFF | AUTO -- build the SYCL (Intel GPU) backend with icpx")
|
||||
set_property(CACHE RAD_SYCL PROPERTY STRINGS ON OFF AUTO)
|
||||
set(RAD_SYCL_TARGETS "intel_gpu_bmg_g31" CACHE STRING "AOT targets for SYCL device code")
|
||||
set(RAD_SYCL_FOUND OFF)
|
||||
if(NOT RAD_SYCL STREQUAL "OFF")
|
||||
find_program(RAD_ICPX icpx HINTS ENV CMPLR_ROOT PATH_SUFFIXES bin
|
||||
PATHS /opt/intel/oneapi/compiler/latest/bin)
|
||||
if(RAD_ICPX)
|
||||
set(RAD_SYCL_FOUND ON)
|
||||
elseif(RAD_SYCL STREQUAL "ON")
|
||||
message(FATAL_ERROR "RAD_SYCL=ON but icpx was not found. Install the oneAPI DPC++ compiler, or "
|
||||
"source /opt/intel/oneapi/setvars.sh first.")
|
||||
endif()
|
||||
endif()
|
||||
if(RAD_SYCL_FOUND AND RAD_HIP_FOUND)
|
||||
# Both could be compiled side by side in principle; nothing has tested one engine holding both,
|
||||
# so a build picks one (docs/SYCL_PORTING.md §4.5).
|
||||
message(FATAL_ERROR
|
||||
"radiance: RAD_SYCL and the HIP backend are both on. One build holds one device backend: "
|
||||
"configure the SYCL build with -DRAD_WITH_HIP=OFF (build.sh --sycl does).")
|
||||
endif()
|
||||
if(RAD_SYCL_FOUND)
|
||||
message(STATUS "radiance: SYCL backend ON, ${RAD_ICPX}, targets ${RAD_SYCL_TARGETS}")
|
||||
endif()
|
||||
|
||||
# ASan + UBSan for host code only. AMD's amdgcn ASan needs xnack+ for its page-fault-based shadow,
|
||||
# and RDNA has no xnack, so the generator expressions keep the flags off HIP. Device kernels rely on
|
||||
# rad-kbench's red zones instead: a poisoned margin around every operand and scratch allocation,
|
||||
@@ -286,6 +318,31 @@ if(NOT RAD_WITH_FFMPEG STREQUAL "OFF")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# ---------------------------------------------------------------- the icpx sub-build
|
||||
# sycl/ is its own CMake project, configured with icpx, so -fsycl code never meets this project's
|
||||
# compiler. rad_core links librad_sycl.so (the device backend) as an imported library.
|
||||
if(RAD_SYCL_FOUND)
|
||||
include(ExternalProject)
|
||||
set(RAD_SYCL_BINARY_DIR ${CMAKE_BINARY_DIR}/sycl)
|
||||
ExternalProject_Add(rad_sycl_build
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/sycl
|
||||
BINARY_DIR ${RAD_SYCL_BINARY_DIR}
|
||||
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${RAD_ICPX}
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DRAD_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-DRAD_SYCL_TARGETS=${RAD_SYCL_TARGETS}
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||
BUILD_ALWAYS ON
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_BYPRODUCTS ${RAD_SYCL_BINARY_DIR}/librad_sycl.so
|
||||
USES_TERMINAL_BUILD ON)
|
||||
add_library(rad_sycl_rt SHARED IMPORTED GLOBAL)
|
||||
set_target_properties(rad_sycl_rt PROPERTIES
|
||||
IMPORTED_LOCATION ${RAD_SYCL_BINARY_DIR}/librad_sycl.so
|
||||
IMPORTED_NO_SONAME ON)
|
||||
add_dependencies(rad_sycl_rt rad_sycl_build)
|
||||
endif()
|
||||
|
||||
add_subdirectory(vendor)
|
||||
add_subdirectory(core)
|
||||
# Kernel plugins, one root directory each. Each holds its kernels, row table and layouts and links
|
||||
|
||||
Reference in new issue
Block a user