1/*******************************************************************************
2* Copyright 2019-2022 Intel Corporation
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*******************************************************************************/
16
17#ifndef GPU_OCL_VERBOSE_HPP
18#define GPU_OCL_VERBOSE_HPP
19
20#include <cstdio>
21
22#include "gpu/compute/device_info.hpp"
23#include "gpu/ocl/ocl_engine.hpp"
24
25namespace dnnl {
26namespace impl {
27namespace gpu {
28namespace ocl {
29
30void print_verbose_header() {
31 ocl_engine_factory_t factory(engine_kind::gpu);
32 for (size_t i = 0; i < factory.count(); ++i) {
33 engine_t *eng_ptr = nullptr;
34 factory.engine_create(&eng_ptr, i);
35 std::unique_ptr<ocl_gpu_engine_t, engine_deleter_t> eng;
36 eng.reset(utils::downcast<ocl_gpu_engine_t *>(eng_ptr));
37 auto *dev_info = eng ? eng->device_info() : nullptr;
38
39 auto s_name = dev_info ? dev_info->name() : "unknown";
40 auto s_ver = dev_info ? dev_info->runtime_version().str() : "unknown";
41
42 printf("onednn_verbose,info,gpu,engine,%d,name:%s,driver_version:%s,"
43 "binary_kernels:%s\n",
44 (int)i, s_name.c_str(), s_ver.c_str(),
45 dev_info->mayiuse_ngen_kernels() ? "enabled" : "disabled");
46 }
47}
48
49} // namespace ocl
50} // namespace gpu
51} // namespace impl
52} // namespace dnnl
53
54#endif
55