tvm
Loading...
Searching...
No Matches
nvtx.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
27#ifndef TVM_SUPPORT_CUDA_NVTX_H_
28#define TVM_SUPPORT_CUDA_NVTX_H_
29
30#include <string>
31
32#ifndef TVM_NVTX_ENABLED
33#define TVM_NVTX_ENABLED 0
34#endif
35
36#if TVM_NVTX_ENABLED
37#include <nvtx3/nvToolsExt.h>
38#endif // TVM_NVTX_ENABLED
39
40namespace tvm {
41namespace support {
42
47 public:
49#if TVM_NVTX_ENABLED
50 explicit NVTXScopedRange(const char* name) { nvtxRangePush(name); }
51#else
52 explicit NVTXScopedRange(const char* name) {}
53#endif // TVM_NVTX_ENABLED
55 explicit NVTXScopedRange(const std::string& name) : NVTXScopedRange(name.c_str()) {}
57#if TVM_NVTX_ENABLED
59#else
61#endif // TVM_NVTX_ENABLED
66};
67
68#ifdef _MSC_VER
69#define TVM_NVTX_FUNC_SCOPE() ::tvm::support::NVTXScopedRange _nvtx_func_scope_(__FUNCSIG__);
70#else
71#define TVM_NVTX_FUNC_SCOPE() \
72 ::tvm::support::NVTXScopedRange _nvtx_func_scope_(__PRETTY_FUNCTION__);
73#endif
74
75} // namespace support
76} // namespace tvm
77
78#endif // TVM_SUPPORT_CUDA_NVTX_H_
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
A class to create a NVTX range. No-op if TVM is not built against NVTX.
Definition nvtx.h:46
~NVTXScopedRange()
Exit an NVTX scoped range.
Definition nvtx.h:60
NVTXScopedRange(NVTXScopedRange &&other)=delete
NVTXScopedRange(const NVTXScopedRange &other)=delete
NVTXScopedRange & operator=(const NVTXScopedRange &other)=delete
NVTXScopedRange & operator=(NVTXScopedRange &&other)=delete
NVTXScopedRange(const char *name)
Enter an NVTX scoped range.
Definition nvtx.h:52
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analyzer.h:40