/* sycl_host.cpp -- inside librad_sycl.so: the engine's logger and error slot, over the table the * engine hands rad_sycl_backend() (sycl_host.h). Built by the icpx sub-build; in the engine's own * build (core/CMakeLists.txt globs this directory) it compiles to nothing. */ #if defined(SYCL_LANGUAGE_VERSION) #include "sycl_host.h" #include "../rad_internal.h" #include #include namespace rad { const SyclHost* g_sycl_host = nullptr; Log log_level() { return g_sycl_host ? (Log)g_sycl_host->log_level() : Log::Warn; } void log_emit(Log l, const char* file, int line, const char* fmt, ...) { char buf[2048]; va_list ap; va_start(ap, fmt); vsnprintf(buf, sizeof buf, fmt, ap); va_end(ap); if (g_sycl_host) g_sycl_host->log((int)l, file, line, buf); else std::fprintf(stderr, "%s\n", buf); } void device_set_error(const char* fmt, ...) { char buf[1024]; va_list ap; va_start(ap, fmt); vsnprintf(buf, sizeof buf, fmt, ap); va_end(ap); if (g_sycl_host) g_sycl_host->set_error(buf); } } /* namespace rad */ #endif /* SYCL_LANGUAGE_VERSION */