/* 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 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);