1/*******************************************************************************
2* Copyright 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#include "gpu/jit/utils/trace.hpp"
18
19#include "gpu/jit/conv/grf_usage.hpp"
20
21namespace dnnl {
22namespace impl {
23namespace gpu {
24namespace jit {
25
26#ifdef GEN_CONV_PROFILE
27ir_utils::debug_profiler_t &get_trace_profiler() {
28 static thread_local ir_utils::debug_profiler_t profiler("Trace Profile");
29 return profiler;
30}
31#endif
32
33#if defined(GEN_CONV_PROFILE) || defined(GEN_CONV_DEBUG)
34void trace_pass(
35 const char *pass_name, const stmt_t &stmt, ir_context_t &ir_ctx) {
36 trace_stop(pass_name);
37 ir_trace() << "=== After " << pass_name << std::endl;
38 ir_trace() << stmt << std::endl;
39#ifdef GEN_CONV_DEBUG
40 auto grf_usage = get_grf_usage(stmt, ir_ctx.hw_cfg().grf_size());
41 if (!grf_usage.is_empty()) ir_trace() << grf_usage << std::endl;
42#endif
43}
44#endif
45
46} // namespace jit
47} // namespace gpu
48} // namespace impl
49} // namespace dnnl
50