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/core/device/sycl_host.h
T
pascallinxweilerandClaude Opus 5.5 370a906c70 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
2026-10-23 15:38:42 +02:00

33 lines
1.4 KiB
C++

/* sycl_host.h -- the seam between the engine and librad_sycl.so, the SYCL device backend.
*
* The SYCL backend is compiled and linked by icpx into a shared library of its own, while the
* engine stays a GCC build (docs/SYCL_PORTING.md §4.5, docs/SYCL_PROGRESS.md D6). The library
* reaches the engine's logger and error slot through this table, so it links nothing of the
* engine's, and the engine reaches the library through one C entry point.
*
* Inside the library, sycl_host.cpp defines rad::log_level, rad::log_emit and
* rad::device_set_error over the table, so the backend's source uses rad_internal.h's macros as
* hip.cpp does. Bump kSyclHostVersion on any change to the table.
*/
#pragma once
#include <cstdint>
namespace rad {
struct DeviceBackend;
constexpr uint32_t kSyclHostVersion = 1;
struct SyclHost {
uint32_t version; /* kSyclHostVersion */
int (*log_level)(void); /* rad::log_level() as an int */
void (*log)(int level, const char* file, int line, const char* msg);
void (*set_error)(const char* msg); /* rad::device_set_error("%s", msg) */
};
} /* namespace rad */
/* The backend, or null when no Level Zero GPU is visible or `host` is of another version. The
* table must outlive the backend. */
extern "C" const rad::DeviceBackend* rad_sycl_backend(const rad::SyclHost* host);