tvm
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  */
19 #ifndef TVM_RUNTIME_NVTX_H_
20 #define TVM_RUNTIME_NVTX_H_
21 
23 
24 #include <string>
25 namespace tvm {
26 namespace runtime {
27 
32  public:
34  TVM_DLL explicit NVTXScopedRange(const char* name);
36  explicit NVTXScopedRange(const std::string& name) : NVTXScopedRange(name.c_str()) {}
38  TVM_DLL ~NVTXScopedRange();
39  NVTXScopedRange(const NVTXScopedRange& other) = delete;
40  NVTXScopedRange(NVTXScopedRange&& other) = delete;
41  NVTXScopedRange& operator=(const NVTXScopedRange& other) = delete;
43 };
44 
45 #ifdef _MSC_VER
46 #define TVM_NVTX_FUNC_SCOPE() NVTXScopedRange _nvtx_func_scope_(__FUNCSIG__);
47 #else
48 #define TVM_NVTX_FUNC_SCOPE() NVTXScopedRange _nvtx_func_scope_(__PRETTY_FUNCTION__);
49 #endif
50 
51 } // namespace runtime
52 } // namespace tvm
53 
54 #endif // TVM_RUNTIME_NVTX_H_
A class to create a NVTX range. No-op if TVM is not built against NVTX.
Definition: nvtx.h:31
NVTXScopedRange(const NVTXScopedRange &other)=delete
NVTXScopedRange & operator=(NVTXScopedRange &&other)=delete
NVTXScopedRange(NVTXScopedRange &&other)=delete
~NVTXScopedRange()
Exist an NVTX scoped range.
NVTXScopedRange(const char *name)
Enter an NVTX scoped range.
NVTXScopedRange & operator=(const NVTXScopedRange &other)=delete
NVTXScopedRange(const std::string &name)
Enter an NVTX scoped range.
Definition: nvtx.h:36
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36