NVTX C API Reference v3
NVIDIA Tools Extension Library
Loading...
Searching...
No Matches
nvToolsExtOpenCL.h
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2009-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * Licensed under the Apache License v2.0 with LLVM Exceptions.
18 * See LICENSE.txt for license information.
19 */
20
21#include "nvToolsExt.h"
22
23#include <CL/cl.h>
24
25#ifndef NVTOOLSEXT_OPENCL_V3
26#define NVTOOLSEXT_OPENCL_V3
27
28#ifdef __cplusplus
29extern "C" {
30#endif /* __cplusplus */
31
32/* ========================================================================= */
44/* ------------------------------------------------------------------------- */
45/* \cond SHOW_HIDDEN
46* \brief Used to build a non-colliding value for resource types separated class
47* \version \NVTX_VERSION_2
48*/
49#define NVTX_RESOURCE_CLASS_OPENCL 6
52/* ------------------------------------------------------------------------- */
56{
57 NVTX_RESOURCE_TYPE_OPENCL_DEVICE = NVTX_RESOURCE_MAKE_TYPE(OPENCL, 1),
58 NVTX_RESOURCE_TYPE_OPENCL_CONTEXT = NVTX_RESOURCE_MAKE_TYPE(OPENCL, 2),
59 NVTX_RESOURCE_TYPE_OPENCL_COMMANDQUEUE = NVTX_RESOURCE_MAKE_TYPE(OPENCL, 3),
60 NVTX_RESOURCE_TYPE_OPENCL_MEMOBJECT = NVTX_RESOURCE_MAKE_TYPE(OPENCL, 4),
61 NVTX_RESOURCE_TYPE_OPENCL_SAMPLER = NVTX_RESOURCE_MAKE_TYPE(OPENCL, 5),
62 NVTX_RESOURCE_TYPE_OPENCL_PROGRAM = NVTX_RESOURCE_MAKE_TYPE(OPENCL, 6),
63 NVTX_RESOURCE_TYPE_OPENCL_EVENT = NVTX_RESOURCE_MAKE_TYPE(OPENCL, 7),
65
66
67/* ------------------------------------------------------------------------- */
77NVTX_DECLSPEC void NVTX_API nvtxNameClDeviceA(cl_device_id device, const char* name);
78NVTX_DECLSPEC void NVTX_API nvtxNameClDeviceW(cl_device_id device, const wchar_t* name);
81/* ------------------------------------------------------------------------- */
91NVTX_DECLSPEC void NVTX_API nvtxNameClContextA(cl_context context, const char* name);
92NVTX_DECLSPEC void NVTX_API nvtxNameClContextW(cl_context context, const wchar_t* name);
95/* ------------------------------------------------------------------------- */
105NVTX_DECLSPEC void NVTX_API nvtxNameClCommandQueueA(cl_command_queue command_queue, const char* name);
106NVTX_DECLSPEC void NVTX_API nvtxNameClCommandQueueW(cl_command_queue command_queue, const wchar_t* name);
109/* ------------------------------------------------------------------------- */
119NVTX_DECLSPEC void NVTX_API nvtxNameClMemObjectA(cl_mem memobj, const char* name);
120NVTX_DECLSPEC void NVTX_API nvtxNameClMemObjectW(cl_mem memobj, const wchar_t* name);
123/* ------------------------------------------------------------------------- */
133NVTX_DECLSPEC void NVTX_API nvtxNameClSamplerA(cl_sampler sampler, const char* name);
134NVTX_DECLSPEC void NVTX_API nvtxNameClSamplerW(cl_sampler sampler, const wchar_t* name);
137/* ------------------------------------------------------------------------- */
154NVTX_DECLSPEC void NVTX_API nvtxNameClProgramA(cl_program program, const char* name);
155NVTX_DECLSPEC void NVTX_API nvtxNameClProgramW(cl_program program, const wchar_t* name);
158/* ------------------------------------------------------------------------- */
168NVTX_DECLSPEC void NVTX_API nvtxNameClEventA(cl_event evnt, const char* name);
169NVTX_DECLSPEC void NVTX_API nvtxNameClEventW(cl_event evnt, const wchar_t* name);
/* END RESOURCE_NAMING */
173
174/* ========================================================================= */
175#ifdef UNICODE
176 #define nvtxNameClDevice nvtxNameClDeviceW
177 #define nvtxNameClContext nvtxNameClContextW
178 #define nvtxNameClCommandQueue nvtxNameClCommandQueueW
179 #define nvtxNameClMemObject nvtxNameClMemObjectW
180 #define nvtxNameClSampler nvtxNameClSamplerW
181 #define nvtxNameClProgram nvtxNameClProgramW
182 #define nvtxNameClEvent nvtxNameClEventW
183#else
184 #define nvtxNameClDevice nvtxNameClDeviceA
185 #define nvtxNameClContext nvtxNameClContextA
186 #define nvtxNameClCommandQueue nvtxNameClCommandQueueA
187 #define nvtxNameClMemObject nvtxNameClMemObjectA
188 #define nvtxNameClSampler nvtxNameClSamplerA
189 #define nvtxNameClProgram nvtxNameClProgramA
190 #define nvtxNameClEvent nvtxNameClEventA
191#endif
192
193#ifdef __cplusplus
194}
195#endif /* __cplusplus */
196
197#ifndef NVTX_NO_IMPL
198#define NVTX_IMPL_GUARD_OPENCL /* Ensure other headers cannot be included directly */
199#include "nvtxDetail/nvtxImplOpenCL_v3.h"
200#undef NVTX_IMPL_GUARD_OPENCL
201#endif /*NVTX_NO_IMPL*/
202
203#endif /* NVTOOLSEXT_OPENCL_V3 */
NVTX_DECLSPEC void NVTX_API nvtxNameClEventA(cl_event evnt, const char *name)
Annotates an OpenCL event.
NVTX_DECLSPEC void NVTX_API nvtxNameClSamplerA(cl_sampler sampler, const char *name)
Annotates an OpenCL sampler.
NVTX_DECLSPEC void NVTX_API nvtxNameClDeviceA(cl_device_id device, const char *name)
Annotates an OpenCL device.
NVTX_DECLSPEC void NVTX_API nvtxNameClMemObjectA(cl_mem memobj, const char *name)
Annotates an OpenCL memory object.
NVTX_DECLSPEC void NVTX_API nvtxNameClProgramA(cl_program program, const char *name)
Annotates an OpenCL program.
nvtxResourceOpenCLType_t
Resource types for OpenCL.
NVTX_DECLSPEC void NVTX_API nvtxNameClCommandQueueA(cl_command_queue command_queue, const char *name)
Annotates an OpenCL command queue.
NVTX_DECLSPEC void NVTX_API nvtxNameClContextA(cl_context context, const char *name)
Annotates an OpenCL context.