#ifndef XPU_ZE_VERBOSE_HPP
#define XPU_ZE_VERBOSE_HPP
#include "xpu/ze/engine_factory.hpp"
#include "xpu/ze/engine_impl.hpp"
#if DNNL_GPU_VENDOR == DNNL_VENDOR_INTEL
#include "gpu/intel/compute/device_info.hpp"
#include "gpu/intel/engine.hpp"
#endif
#include <cstdio>
namespace dnnl {
namespace impl {
namespace xpu {
namespace ze {
inline void print_verbose_header() {
xpu::ze::engine_factory_t factory(engine_kind::gpu);
verbose_printf("info,gpu,engine,level zero device count:%zu %s\n",
factory.count(),
factory.count() == 0 ? "- no devices available." : "");
for (size_t i = 0; i < factory.count(); ++i) {
impl::engine_t *eng_ptr = nullptr;
status_t status = factory.engine_create(&eng_ptr, i);
if (status != status::success) {
VERROR(common, ze, VERBOSE_INVALID_DEVICE_ENV,
dnnl_engine_kind2str(engine_kind::gpu), i);
continue;
}
const auto *engine_impl
= utils::downcast<const xpu::ze::engine_impl_t *>(
eng_ptr->impl());
const auto &s_name = engine_impl->name();
auto s_ver = engine_impl->runtime_version().str();
#if DNNL_GPU_VENDOR == DNNL_VENDOR_INTEL
auto *intel_engine = utils::downcast<gpu::intel::engine_t *>(eng_ptr);
auto *dev_info = intel_engine->device_info();
verbose_printf(
"info,gpu,engine,%d,name:%s,driver_version:%s,binary_kernels:%"
"s\n",
(int)i, s_name.c_str(), s_ver.c_str(),
dev_info->mayiuse_ngen_kernels() ? "enabled" : "disabled");
#else
verbose_printf("info,gpu,engine,%d,name:%s,driver_version:%s\n", (int)i,
s_name.c_str(), s_ver.c_str());
#endif
eng_ptr->release();
}
}
} } } }
#endif